Foswiki on GitHub is open for business! Next release meeting: Monday September 1, 1300Z

Item10041: Configure's logger-advice is incomplete, when upgrading to 1.1

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Engine Configure, Logger  
The logger interface has changed in 1.1, as the logger implementation is not necessarily file-based.

If you upgrade from 1.0 to 1.1 and copy your LocalSite.cfg, then configure detects this and suggests changes to the logger configuration. However, these suggestions are incomplete (or at least, not entirely compatible with the compatibility logger) and this results in foswiki writing its logs into the bin directory.

There are several problems:
  • Foswiki::new() automatically selects the Compatibility logger if $Foswiki::cfg{WarningFileName} is defined and $Foswiki::cfg{Log}{Implementation} is 'Foswiki::Logger::PlainFile'. If that test fails (e.g. because the admin selected the Compatibility logger via configure), Foswiki::new() automatically sets $Foswiki::cfg{LogFileName} - overwriting the value that was set via configure, if there was one.
  • Foswiki::Logger::Compatibility::_getLogForLevel() does not include a directory in its default values, so if the default values are used, then the log files can end up in the bin directory. Writing them to the data directory would be less surprising.
  • The Foswiki.spec documentation for $Foswiki::cfg{Log}{Implementation} says that the Compatibility logger is automatically selected if configure detects $Foswiki::cfg{WarningFileName}. That is consistent with Foswiki::new(). However, Foswiki::Configure::Checkers::Log::Implementation::check() automatically selects the compatibility logger if $Foswiki::cfg{LogFileName} is defined and $Foswiki::cfg{Log}{Implementation} is 'Foswiki::Logger::PlainFile', and the warning message refers to $Foswiki::cfg{LogFileName}.
    • If the admin decides "yes, I will use the compatibility logger, and that is where I want my logs to go" and clicks save, Foswiki does not use the specified $Foswiki::cfg{LogFileName} setting.
    • If the admin sees the warning, removes $Foswiki::cfg{LogFileName} and sets $Foswiki::cfg{Log}{Implementation} to 'Foswiki::Logger::PlainFile', Foswiki will continue to use the Compatibility logger without any warnings (in configure, or anywhere else), because the configure warning is based on LogFileName whereas $Foswiki::new() checks for WarningFileName.

I propose that:
  1. Foswiki::Logger::Compatibility::_getLogForLevel() should prefix the default filenames with $Foswiki::cfg{DataDir}/.
  2. $Foswiki::new() should only set $Foswiki::cfg{LogFileName} if it is not already defined.
  3. The {Log}{Implementation} configure checker should check for any of LogFileName, WarningFileName and DebugFileName, and suggest the removal of all three if any is detected.
  4. The documentation in Foswiki.spec should suggest the removal of LogFileName, WarningFileName and DebugFileName.

-- MichaelTempest - 17 Nov 2010

Yes to all the above. I would prefer that _getLogForLevel only prepend the datadir only if the filename is not an existing absolute file path, but that may be overkill (don't know without reading the code)

-- CrawfordCurrie - 18 Nov 2010
 

ItemTemplate edit

Summary Configure's logger-advice is incomplete, when upgrading to 1.1
ReportedBy MichaelTempest
Codebase 1.1.2, 1.1.1, 1.1.0, 1.1.0 beta1, trunk
SVN Range
AppliesTo Engine
Component Configure, Logger
Priority Normal
CurrentState Closed
WaitingFor
Checkins Foswikirev:10001 Foswikirev:10002
TargetRelease patch
ReleasedIn 1.1.3
Topic revision: r7 - 16 Apr 2011, KennethLavrsen
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License