File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Problems with DailyRollingFileAppender in log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Problems with DailyRollingFileAppender in log4j" Watch "Problems with DailyRollingFileAppender in log4j" New topic

Problems with DailyRollingFileAppender in log4j

Saurabh Agrawal
Ranch Hand

Joined: Oct 07, 2003
Posts: 244
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,

Success is not doing extraordinary things but doing ordinary things extraordinarily well.
I agree. Here's the link:
subject: Problems with DailyRollingFileAppender in log4j
jQuery in Action, 3rd edition