14 Aralık 2011 Çarşamba

delete log files automatically with log4j

With RollingFileAppender, there is a maxBackupIndex property which specifies the number of log files that will be kept.. Unfortunately, DailyRollingFileAppender does not support such property. Therefore, to use maxBackupIndex with DailyRollingFileAppenderhttp://www.codeproject.com/KB/java/CustomDailyRollingFileApp.aspx (and http://wiki.apache.org/logging-log4j/DailyRollingFileAppender) provides a custom DailyRollingFileAppender.

I included the file http://wiki.apache.org/logging-log4j/DailyRollingFileAppender in my project.. By the way, since some classes used (such as org.apache.log4j.RollingCalendar) is not visible outside the package org.apache.log4j, do not try to put the file in another package..

Hiç yorum yok:

Yorum Gönder