• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in Log4j  RSS feed

 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!