diff --git a/checkin_notes b/checkin_notes index 10568531bc..84c99d99ef 100644 --- a/checkin_notes +++ b/checkin_notes @@ -9863,3 +9863,14 @@ David 24 Oct 2007 hostinfo_unix.C html/user/ create_profile.php + +David 24 Oct 2007 + - client: add and + cc_config.xml options to change log file size limit + from the default of 2 MB + + client/ + log_flags.C,h + main.C + lib/ + diagnostics.C,h diff --git a/client/log_flags.C b/client/log_flags.C index 76a932c748..442fda05c5 100644 --- a/client/log_flags.C +++ b/client/log_flags.C @@ -200,6 +200,8 @@ void CONFIG::defaults() { no_alt_platform = false; simple_gui_only = false; dont_contact_ref_site = false; + max_stdout_file_size = 0; + max_stderr_file_size = 0; alt_platforms.clear(); } @@ -241,6 +243,8 @@ int CONFIG::parse_options(XML_PARSER& xp) { } continue; } + if (xp.parse_int(tag, "max_stdout_file_size", max_stdout_file_size)) continue; + if (xp.parse_int(tag, "max_stderr_file_size", max_stderr_file_size)) continue; msg_printf(NULL, MSG_USER_ERROR, "Unparsed tag in %s: <%s>\n", CONFIG_FILE, tag ); diff --git a/client/log_flags.h b/client/log_flags.h index 5a1d91d491..c0eddae4c7 100644 --- a/client/log_flags.h +++ b/client/log_flags.h @@ -98,6 +98,8 @@ struct CONFIG { bool simple_gui_only; bool dont_contact_ref_site; std::vector alt_platforms; + int max_stdout_file_size; + int max_stderr_file_size; CONFIG(); void defaults(); diff --git a/client/main.C b/client/main.C index d32b77e6a0..e8276d2896 100644 --- a/client/main.C +++ b/client/main.C @@ -320,6 +320,7 @@ static void init_core_client(int argc, char** argv) { } diagnostics_init(flags, "stdoutdae", "stderrdae"); + diagnostics_set_max_file_sizes(config.max_stdout_file_size, config.max_stderr_file_size); // Win32 - detach from console if requested #ifdef _WIN32 diff --git a/lib/diagnostics.C b/lib/diagnostics.C index 32e9875aec..bf7d49990f 100644 --- a/lib/diagnostics.C +++ b/lib/diagnostics.C @@ -53,10 +53,6 @@ #include "diagnostics.h" -#define MAX_STDERR_FILE_SIZE 2048*1024 -#define MAX_STDOUT_FILE_SIZE 2048*1024 - - #if defined(_WIN32) && defined(_MSC_VER) static _CrtMemState start_snapshot; @@ -79,6 +75,8 @@ static int boinc_proxy_enabled; static char boinc_proxy[256]; static char symstore[256]; static int aborted_via_gui; +static int max_stderr_file_size = 2048*1024; +static int max_stdout_file_size = 2048*1024; #if defined(_WIN32) && defined(_DEBUG) @@ -453,7 +451,7 @@ int diagnostics_cycle_logs() { #else file_size(stderr_log, f_size); #endif - if (MAX_STDERR_FILE_SIZE < f_size) { + if (f_size > max_stderr_file_size) { fclose(stderr_file); boinc_copy(stderr_log, stderr_archive); stderr_file = freopen(stderr_log, "w", stderr); @@ -470,7 +468,7 @@ int diagnostics_cycle_logs() { #else file_size(stdout_log, f_size); #endif - if (MAX_STDOUT_FILE_SIZE < f_size) { + if (f_size > max_stdout_file_size) { fclose(stdout_file); boinc_copy(stdout_log, stdout_archive); stdout_file = freopen(stdout_log, "w", stdout); @@ -655,5 +653,9 @@ void boinc_info(const char* pszFormat, ...){ } #endif +void diagnostics_set_max_file_sizes(int stdout_size, int stderr_size) { + if (stdout_size) max_stdout_file_size = stdout_size; + if (stderr_size) max_stderr_file_size = stderr_size; +} const char *BOINC_RCSID_4967ad204c = "$Id$"; diff --git a/lib/diagnostics.h b/lib/diagnostics.h index 407dedc325..544d2238ec 100644 --- a/lib/diagnostics.h +++ b/lib/diagnostics.h @@ -91,6 +91,7 @@ extern int diagnostics_set_aborted_via_gui(); // Log rotation extern int diagnostics_cycle_logs(); +extern void diagnostics_set_max_file_sizes(int stdout_size, int stderr_size); // Thread Tracking extern int diagnostics_init_thread_list();