• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding Date & time Stamp in Log file name

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using Log4j. In configuration file(XML File), i am using RollingFileAppender... i am generationg output log file(AppINFO.log) based on maxFileSize property. Can i include or append Date pattern in output log file name dynamically.



In the above XML code...need to append Date pattern in file name, i.e:
<param name="File" value="C:/temp/AppINFO.<Year&Date>.log"/>
Can anyone please help me on this?
Thanks in advance,
Yugandhar.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will probably need to use a custom appender.

I have not tried this out, but there is a code snippet and example configuration of a "Timestamp File Appender" on the log4j wiki's Useful Code section. It looks pretty old, so may need updating to use with a newer version of log4j.

reply
    Bookmark Topic Watch Topic
  • New Topic