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

Priority: Normal
Current State: Closed
Released In: 1.1.3
Target Release: patch
Applies To: Engine
Component: Configure, Logger
Reported By: MichaelTempest
Waiting For:
Last Change By: KennethLavrsen
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
Checkins distro:bb61cf63b6cf distro:7fb3255093cd
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 Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy