X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fstatserv.c;h=5c29e32f15bfa0f1b3b8ce571b12bad3c58a3e46;hb=951fce6496397a6d8c11e15ab5b60b46abc43467;hp=5556cd14b072359d6081ae334c4c0c7308a8ba5a;hpb=b64382a1e420049b882b87fb05fe058aa6592d1c;p=yaz-moved-to-github.git diff --git a/src/statserv.c b/src/statserv.c index 5556cd1..5c29e32 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -1,11 +1,11 @@ /* - * Copyright (C) 1995-2006, Index Data ApS + * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.43 2006-09-27 11:39:02 adam Exp $ + * $Id: statserv.c,v 1.46 2007-01-03 08:42:15 adam Exp $ */ /** @@ -85,8 +85,7 @@ static statserv_options_block *current_control_block = 0; /* * default behavior. */ -#define STAT_DEFAULT_LOG_LEVEL "none,fatal,warn,log,server,session,request" -/* the 'none' clears yaz' own default settings, including [log] */ +#define STAT_DEFAULT_LOG_LEVEL "server,session,request" int check_options(int argc, char **argv); statserv_options_block control_block = { @@ -1337,19 +1336,10 @@ int check_options(int argc, char **argv) int ret = 0, r; char *arg; - if (getenv("YAZ_LOG") == 0) { - /* - * Set default log level. We want to avoid doing this if the - * user has already explicitly specified a preferred default - * log-level, hence the inelegant peek at the YAZ_LOG - * environment variable that will subsequently be interpreted - * by the YAZ logging module itself. - */ - yaz_log_init_level(yaz_log_mask_str(STAT_DEFAULT_LOG_LEVEL)); - } - + yaz_log_init_level(yaz_log_mask_str(STAT_DEFAULT_LOG_LEVEL)); get_logbits(1); - while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:f:m:", + + while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:f:m:r:", argv, argc, &arg)) != -2) { switch (ret) @@ -1395,12 +1385,10 @@ int check_options(int argc, char **argv) } yaz_log_time_format(arg); break; - case 'v': { - int default_level = yaz_log_mask_str(STAT_DEFAULT_LOG_LEVEL); - yaz_log_init_level(yaz_log_mask_str_x(arg, default_level)); + case 'v': + yaz_log_init_level(yaz_log_mask_str(arg)); get_logbits(1); break; - } case 'a': option_copy(control_block.apdufile, arg); break; @@ -1459,6 +1447,14 @@ int check_options(int argc, char **argv) case 'D': control_block.background = 1; break; + case 'r': + if (!arg || !(r = atoi(arg))) + { + fprintf(stderr, "%s: Specify positive size for -r.\n", me); + return(1); + } + yaz_log_init_max_size(r * 1024); + break; default: fprintf(stderr, "Usage: %s [ -a -v " " -l -u -c -t "