From 47df1aa7d86256f46f85a3e57a10056c2be235ef Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 6 Jun 2009 11:13:17 +1200 Subject: [PATCH] Make debug_options rotate=N option back-compatible. This ties older config which do not set rotate=N to still use the value of logfile_rotate. If set rotate=N overrides logfile_rotate and can be any value 0 or up. --- src/cache_cf.cc | 4 ++++ src/cf.data.pre | 5 +++-- src/debug.cc | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index cb6767d9b7..be7315f6a1 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -427,6 +427,10 @@ configDoConfigure(void) memConfigure(); /* Sanity checks */ + if (Debug::rotateNumber < 0) { + Debug::rotateNumber = Config.Log.rotateNumber; + } + #if SIZEOF_OFF_T <= 4 if (Config.Store.maxObjectSize > 0x7FFF0000) { debugs(3, 0, "WARNING: This Squid binary can not handle files larger than 2GB. Limiting maximum_object_size to just below 2GB"); diff --git a/src/cf.data.pre b/src/cf.data.pre index 8fedb2d25a..32f38b1522 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -2635,7 +2635,7 @@ DOC_END NAME: debug_options TYPE: eol -DEFAULT: rotate=1 ALL,1 +DEFAULT: ALL,1 LOC: Debug::debugOptions DOC_START Logging options are set as section,level where each source file @@ -2646,7 +2646,8 @@ DOC_START The magic word "ALL" sets debugging levels for all sections. We recommend normally running with "ALL,1". - The rotate= option can be increased to keep more of these logs. + The rotate=N option can be used to keep more or less of these logs + than would otherwise be kept by logfile_rotate. For most uses a single log should be enough to monitor current events affecting Squid. DOC_END diff --git a/src/debug.cc b/src/debug.cc index 6e3bbc8055..4088ba335b 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -52,7 +52,7 @@ bool Debug::log_syslog = false; int Debug::Levels[MAX_DEBUG_SECTIONS]; int Debug::level; char *Debug::cache_log = NULL; -int Debug::rotateNumber = 1; +int Debug::rotateNumber = -1; FILE *debug_log = NULL; static char *debug_log_file = NULL; static int Ctx_Lock = 0; -- 2.39.2