Register / Login
Win a copy of
Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA)
this week in the
Other Open Source Projects
Problems with DailyRollingFileAppender in log4j
posted 10 years ago
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
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.
How to set maxsize of logfile
DaiylRollingFileAppender | log4j
log3j DailyRolligProblem in Solaris