Java – Log4j fixed file size setting example

log4j.rootLogger=INFO, loggerId  
log4j.appender.loggerId=org.apache.log4j.rolling.RollingFileAppender  
log4j.appender.loggerId.rollingPolicy=org.apache.log4j.rolling.FixedWindowRollingPolicy  
log4j.appender.loggerId.rollingPolicy.maxIndex=5  
log4j.appender.loggerId.triggeringPolicy=org.apache.log4j.rolling.SizeBasedTriggeringPolicy  
log4j.appender.loggerId.triggeringPolicy.MaxFileSize=10000000  
log4j.appender.loggerId.rollingPolicy.FileNamePattern=app-%i.log.zip  
log4j.appender.loggerId.rollingPolicy.ActiveFileName=app.log  
log4j.appender.loggerId.layout=org.apache.log4j.PatternLayout  
log4j.appender.loggerId.layout.ConversionPattern=%d [%t] %-5p (%F:%L) - %m%n  
 
Advertisements
This entry was posted in Java, Programming and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s