• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with DailyRollingFileAppender in log4j

Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am facing a strange issue using DailyRollingFileAppender of log4j.

I want to append the date to my logfile's name Eg. Sample.log.25_08_2005 , so that i get the logs for all days in seperate files.

For this DailyRollingFileAppender can be used which rolls at the midnight and renames your file with the name appended by the date of the day.

But since my application which uses log4j is a standalone application and not a client server application, so it does not roll back and i get the log file by the name Sample.log itself.

On googling i found for DailyRollingFileAppender to work, your application should be running at midnight ; but in my case this cant happen.

So can anyone tell me how to achieve this using log4j i.e. appending date to the filename.I dont want to code additionaly to attain this.I am sure log4j is robust enough to support this.

Please help me out if incase any guys have faced the same issue.

Thanks in advance,
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic