Need helping configuring Log4j configuration file to mirror current setup
posted 4 years ago
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 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.
An IDE is no substitute for an Intelligent Developer.