Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j DailyRollingFileAppender

 
Benjamin Hundley
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
%m%n"/>
-->
</layout>
</appender>

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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doh! I think I just figured it out. Appender property was set to false.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic