- client: add <max_stdout_file_size> and <max_stderr_file_size>

cc_config.xml options to change log file size limit
    from the default of 2 MB

svn path=/trunk/boinc/; revision=13955
This commit is contained in:
David Anderson 2007-10-24 22:48:47 +00:00
parent 930c8ad9c7
commit 7c20a8c5cf
6 changed files with 27 additions and 6 deletions

View File

@ -9863,3 +9863,14 @@ David 24 Oct 2007
hostinfo_unix.C
html/user/
create_profile.php
David 24 Oct 2007
- client: add <max_stdout_file_size> and <max_stderr_file_size>
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

View File

@ -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
);

View File

@ -98,6 +98,8 @@ struct CONFIG {
bool simple_gui_only;
bool dont_contact_ref_site;
std::vector<std::string> alt_platforms;
int max_stdout_file_size;
int max_stderr_file_size;
CONFIG();
void defaults();

View File

@ -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

View File

@ -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$";

View File

@ -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();