Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use log4j to log a file whose file name is daily based?

 
Hai Lin
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I'm using log4j to do log for the java application, and the logged file name should be automatically changed every day, for example, today's log file should be 12152004test1.log (today is Dec/15), and tomorrow's log will automatically become 12162004test1.log when I start up the application.
Could anyone tell me how to set the property about:

log4j.rootCategory=DEBUG, MYLOG
log4j.appender.MYLOG.File=C:\\tomcat\\webapps\\test\\...

Thanks a lot.

Hai
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a Servlet question, moving to Other Open Source Projects
[ December 16, 2004: Message edited by: David O'Meara ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the javadocs of org.apache.log4j.DailyRollingFileAppender.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic