hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie Cockrill <jamie.cockr...@gmail.com>
Subject Re: log4j.properties
Date Tue, 17 May 2011 22:00:17 GMT
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 <shahsaifi@gmail.com> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message