Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need helping configuring Log4j configuration file to mirror current setup

 
Bruce Kent
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am attempting to configure Log4j in Apache Tomcat 5.5, replacing the previous logging system, which I believe is JULI. I wish to mirror the current setup in Log4j, but add the ability to split the log files dynamically if they reach a certain file size in the format of logfilename_YYYY-MM-DD_Number.log, i.e. Catalina_2011-04-18_1.log, Catalina_2011-04-18_2.log.

Let me stop and say I believe I have installed and configured Log4j correctly, placing the files in the proper directories. It's simply a matter of understanding how to configure the log4j.properties file.

For example, this worked:



But the next one didn't...
As a test, for I want to use baby steps to minimize confusion for myself and for others reading this post, here is the contents of the log4j.properties file, currently:



Unfortunately, nothing happens and I don't know why. I thought DailyRollingfileAppender will allow me to split a 30 KB Catalina log file into 10 3 KB files in the format of Catalina_YYYY-MM-DD_Number.log. The whole idea is to limit the file size and include the date and the number of the file, if it's too big to put into one file, all in the file name.

I would appreciate any help.

Thank you.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18014
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you have to use the XML version of the log4j config file (log4j.xml) to properly configure the rolling file appender. I forget exactly why, but I don't think it's supported using log4j.properties.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic