You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by James Stauffer <js...@spscommerce.com> on 2004/04/12 21:34:21 UTC

Logs separated by year/mon/day

With our current home-grown logger are logs are put in
webec\logs/yyyy/MM-MMM/dd-EEE/type/  For the "Error" type it is also grouped
by "machine/servlet" and the log name is "HH-mm-ss-S.log".
Examples: 
webec\logs\2004\04-Apr\12-Mon\Cache\12-11-15-593.log
webec\logs\2004\04-Apr\12-Mon\Error\DEV-JS\sps.webec.server.servlets.GetDocu
ment\12-11-32-515.log
 
How can I get similar grouping of logs with log4j?  I have tried using a
DailyRollingFileAppender per below but it doesn't seem to work.  If creates
W.log but doesn't seem to roll it.
    <appender name="file" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="webec/logs/W.log" />
        <param name="DatePattern"
value="'webec/logs/''.'yyyy-MM-MMM-dd-EEE-HH-mm" />      
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
              value="%d{ISO8601} %p (%C;%L) %m%n"
            />
        </layout>
    </appender>

 
Note:
Our application generates a ton of logs so putting them all in one directory
doesn't work well.  After I get the file logs to work I plan to put them in
a Database (JDBC or through JMS) but I want to have the file option as a
backup.

James Stauffer