• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

log4j DailyRollingFileAppender

 
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
Boost this thread!