Ignore:
Timestamp:
02/23/10 12:46:38 (3 years ago)
Author:
CrawfordCurrie
Message:

Item2008: move logs out of the data dir and put them in working/logs, and clean up the config

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki/Logger/PlainFile.pm

    r4898 r6495  
    1818 
    1919This logger implementation maps groups of levels to a single logfile, viz. 
    20    * =debug= messages are output to $Foswiki::cfg{DebugFileName} 
    21    * =info= messages are output to $Foswiki::cfg{LogFileName} 
     20   * =debug= messages are output to $Foswiki::cfg{Log}{Dir}/debug%DATE%.log 
     21   * =info= messages are output to $Foswiki::cfg{Log}{Dir}/log%DATE%.log 
    2222   * =warning=, =error=, =critical=, =alert=, =emergency= messages are 
    23      output to $Foswiki::cfg{WarningFileName}. 
     23     output to $Foswiki::cfg{Log}{Dir}/warn%DATE%.log. 
    2424   * =error=, =critical=, =alert=, and =emergency= messages are also 
    2525     written to standard error (the webserver log file, usually) 
     
    2929use Foswiki::Time         (); 
    3030use Foswiki::ListIterator (); 
     31 
     32# Map from a log level to the root of a log file name 
     33our %LEVEL2LOG = ( 
     34    debug     => 'debug', 
     35    info      => 'events', 
     36    warning   => 'error', 
     37    error     => 'error', 
     38    critical  => 'error', 
     39    alert     => 'error', 
     40    emergency => 'error' 
     41   ); 
    3142 
    3243# Local symbol used so we can override it during unit testing 
     
    6778    } 
    6879    else { 
     80        # die to force the admin to get permissions correct 
    6981        die 'ERROR: Could not write ' . $message . ' to ' . "$log: $!\n"; 
    7082    } 
     
    192204sub _getLogForLevel { 
    193205    my $level = shift; 
    194     my $log; 
    195     if ( $level eq 'debug' ) { 
    196         $log = $Foswiki::cfg{DebugFileName}; 
    197     } 
    198     elsif ( $level eq 'info' ) { 
    199         $log = $Foswiki::cfg{LogFileName}; 
    200     } 
    201     else { 
    202         ASSERT( $level =~ /^(warning|error|critical|alert|emergency)$/ ) 
    203           if DEBUG; 
    204         $log = $Foswiki::cfg{WarningFileName}; 
    205     } 
    206     return $log; 
     206    ASSERT(defined $LEVEL2LOG{$level}) if DEBUG; 
     207    my $log = $LEVEL2LOG{$level}; 
     208    return "$Foswiki::cfg{Log}{Dir}/$log%DATE%.log"; 
    207209} 
    208210 
     
    211213Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/ 
    212214 
    213 Copyright (C) 2008-2009 Foswiki Contributors. Foswiki Contributors 
     215Copyright (C) 2008-2010 Foswiki Contributors. Foswiki Contributors 
    214216are listed in the AUTHORS file in the root of this distribution. 
    215217NOTE: Please extend that file, not this notice. 
Note: See TracChangeset for help on using the changeset viewer.