• 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

Problem in Log4j

 
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends,

I have the following log4j.properties file:

log4j.logger.com.test=INFO,log
log4j.appender.log=org.apache.log4j.DailyRollingFileAppender
log4j.appender.log.File=C:/Test.log
log4j.appender.log.DatePattern='.'yyyy-MM-dd
log4j.appender.log.Append=true
log4j.appender.log.layout=org.apache.log4j.PatternLayout
log4j.appender.log.layout.ConversionPattern=%-d %X [%c{2}:%L] %-5p: %m%n %x %n

and i wrote a sample code :


The log file name i need is Test.log_yyyy-MM-dd. But its generating only file name with Test.log

Kindly provide your help. I need the current date to be appended in the log file name. Please point out my mistakes if any.

Thanks & Regards,
Vijay
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The name of the currently active file is determined by the log4j.appender.log.File pattern. It will be renamed to include the date pattern after it's been rolled over.
 
reply
    Bookmark Topic Watch Topic
  • New Topic