Hi Tim- I use the DailyRollingFileAppender to roll over my log file daily at midnight. I couldn't get the regular DailyRollingFileAppender class to work properly so I use the DailyRollingFileAppenderExt class and that works great. The XML properties are similiar. However, I don't believe you can set the maximum number of logs with the regular DailyRollingFileAppender class. To do this, you would also need to use DailyRollingFileAppenderExt. Here's my portion of XML config (using DailyRollingFileAppenderExt):
<appender name="dailyRollFile" class="org.apache.log4j.DailyRollingFileAppenderExt"> <param name="DatePattern" value="'.'yyyy-MM-dd"/> <param name="MaxLogs" value="30"/> <param name="File" value="logs/fms.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%-15d{ABSOLUTE} %-10p (%c) - %m%n"/> </layout> </appender> 1. You set the MaxLogs property. This can be any integer value. This is only available using the DailyRollingFileAppenderExt class. 2. For the different date patterns, look at the DailyRollingFileAppender javadoc. It explains 6 different date patterns. 3. Can't help you here - I run JBuilder5 with Tomcat for dev and JRun for prod. Hope this helps! Sara -----Original Message----- From: Tim Wei-TM [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 3:00 PM To: '[EMAIL PROTECTED]' Subject: I can not use DailyRollingFileAppender properly Hi All, I wonder whether anybody can give me a completely example of the XML configuration file for the DailyRollingFileAppender? If you don't mind, I have the following questions: 1. How can I let the DailyRollingFileAppender to keep only one generation of the rolled over file? i.e, if I want to roll over once a week, I only want to keep the log file for this week and last week, no more than that. 2. The following is my XML configuration file(roll over once a week is not set, I don't know how). What else I missing? 3. If I do not have the weblogic/logs directories, will log4j create them for me? Or do I have to phisically create those two directories under /work before hand? If the answer is yes, how can I do it? Thanks. Tim **************************** <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration> <appender name="dailyRollFile" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="/work/weblogic/logs/portal.log" /> <param name="DatePattern" value="'.'yyyy-ww" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%-15d{ABSOLUTE} %-10p (%c) - %m%n" /> </layout> </appender> <category name="com.telusmobility.portal.register" priority="debug"> <appender-ref ref="dailyRollFile" /> </category> <root priority="debug"> <appender-ref ref="dailyRollFile" /> </root> </log4j:configuration> ____________________________________________________ Tim Wei Programmer/Analyst --------------------------- E-Business Infrastructure > * (416) 279-4348 TELUS > Mobility > ] (416) 684-4348 > -------------------------------------------- > * 43480 > www.telusmobility.com > * [EMAIL PROTECTED] www.geocities.com/timwei > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>