Hi Peter, That was exactly what I was looking for and it seems to work in tomcat too with a few tweaks.
Thanks a lot Jorge Quoting Peter Götz <[email protected]>: > Hi Jorge, > > this is not from the Tomcat configuration but from my JBoss logging config, > but it should work just the same. There exists a DailyRollingFileAppender > that should work for this. The example I give you is from JBoss, that's why > the class name is JBoss-like. You can easily change that to the corresponding > log4j class. > > <appender name="FILE" > class="org.jboss.logging.appender.DailyRollingFileAppender"> > <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> > <param name="File" value="${jboss.server.home.dir}/log/server.log"/> > <param name="Append" value="false"/> > > <!-- Rollover at midnight each day --> > <param name="DatePattern" value="'.'yyyy-MM-dd"/> > > <!-- Rollover at the top of each hour > <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/> > --> > > <layout class="org.apache.log4j.PatternLayout"> > <!-- The default pattern: Date Priority [Category] Message\n --> > <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> > > <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) > Message\n > <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) > %m%n"/> > --> > </layout> > </appender> > > I hope this helps you. > > Peter > > > ----- Original Message ----- > From: jorgecab > [mailto:[EMAIL PROTECTED] > To: [email protected] > Sent: Mon, > 14 Aug 2006 12:06:00 +0200 > Subject: [magnolia-user] Log rotation > > > > Hi everyone, > > > > I have currently configured magnolia's logs (magnolia-debug.log, > > magnolia-error.log and magnolia-activation.log) so that when it reaches > > a size > > of 1MB it rotates starting a new log file. In > > WEB-INF/config/default/log4j.xml > > I have the following lines for magnolia-error.log for example: > > > > <appender name="sync-log-error" > > class="org.apache.log4j.RollingFileAppender"> > > <param name="File" > > value="${magnolia.author.root}logs/magnolia-error.log" /> > > <param name="MaxFileSize" value="1MB" /> > > <param name="Threshold" value="ERROR" /> > > <param name="MaxBackupIndex" value="5" /> > > <param name="Append" value="true" /> > > <layout class="org.apache.log4j.PatternLayout"> > > <param name="ConversionPattern" value="%-5p %c %d{dd.MM.yyyy > > HH:mm:ss} -- > > %m%n" /> > > </layout> > > </appender> > > > > I want to change that now so that the file rotates every day, I'm not > > that > > experienced with tomcat but I read that I had to set the RollingStyle > > property > > to date and set a DatePattern property for this to work so I did > > something like > > this for magnolia-debug.log: > > > > <appender name="sync-log-debug" > > class="org.apache.log4j.RollingFileAppender"> > > <param name="File" > > value="${magnolia.author.root}logs/magnolia-debug.log" /> > > <param name="RollingStyle" value="date" /> > > <param name="DatePattern" value="dd.MM.yyyy" /> > > <param name="MaxFileSize" value="1MB" /> > > <param name="Threshold" value="DEBUG" /> > > <param name="MaxBackupIndex" value="5" /> > > <param name="Append" value="true" /> > > <layout class="org.apache.log4j.PatternLayout"> > > <param name="ConversionPattern" value="%-5p %c %d{dd.MM.yyyy > > HH:mm:ss} -- > > %m%n" /> > > </layout> > > </appender> > > > > But it's not working, has anybody done this before? am I on the right > > track on > > this one? By the way, can catalina.out be rotated on a daily basis too? > > right > > now I'm rotating it with logrotate in linux but I read somewhere that > > it's not > > a safe option. > > > > Thanks for your help > > > > Jorge > > > > -- > > > > > > ---------------------------------------------------------------- > > This message was sent using IMP, the Internet Messaging Program. > > > > > > ---------------------------------------------------------------- > > for list details see > > http://www.magnolia.info/en/magnolia/developer.html > > ---------------------------------------------------------------- > > > > ---------------------------------------------------------------- > for list details see > http://www.magnolia.info/en/magnolia/developer.html > ---------------------------------------------------------------- > -- ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. ---------------------------------------------------------------- for list details see http://www.magnolia.info/en/magnolia/developer.html ----------------------------------------------------------------
