Hi Shah, You've not mentioned which version of log4j you're using so I'm going to guess 1.2. I'm also not an expert, but I'll give it a go.
I don't think you can set a max number of files to keep with the DailyRollingFileAppender. You can with RollingFileAppender. This seems to be a relatively common complaint (stick "dailyrollingfileappender maxbackupindex" into google). There are examples of how you could make your own appender to do what you want if you so wished. For example: http://www.codeproject.com/KB/java/CustomDailyRollingFileApp.aspx Also, having a look at the API ( http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html and http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html), there only exist setters for max backup index and max backup size on the RollingFileAppender. DailyRollingFileAppender only takes a date-pattern. If you want to manage your log files by size (and only keep so many of them) use RollingFileAppender. If you want to manage them with a date format, use DailyRollingFileAppender (but you wont be able to get it to manage how many files it keeps). Ta Jamie On 17 May 2011 11:47, shahsaifi <[email protected]> wrote: > Please help me out with this. > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/log4j-properties-tp2842411p2951985.html > Sent from the Hadoop lucene-users mailing list archive at Nabble.com. >
