File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Java Products and Servers and the fly likes log4j DailyRollingFileAppender Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "log4j DailyRollingFileAppender" Watch "log4j DailyRollingFileAppender" New topic

log4j DailyRollingFileAppender

Benjamin Hundley
Ranch Hand

Joined: Mar 06, 2006
Posts: 54
I have configured a DailyRollingFileAppender in log4j but I don't seem to see different logs for different dates. Here is my configuration.

<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="log/my_log.log" />
<param name="Append" value="false" />
<param name="Threshold" value="INFO" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] %m%n" />

The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)

My program runs once a day... it isn't continously running. So is this why it doesn't seem to create a new log file? Also all I see is the my_log.log file. But I don't see any date in the title? Is this running correctly? Am I missing something?
Benjamin Hundley
Ranch Hand

Joined: Mar 06, 2006
Posts: 54
Also another problem, it overwrites the old log every time I run it with the new log. I had expected it to append to the log.
Benjamin Hundley
Ranch Hand

Joined: Mar 06, 2006
Posts: 54
Doh! I think I just figured it out. Appender property was set to false.
I agree. Here's the link:
subject: log4j DailyRollingFileAppender
jQuery in Action, 3rd edition