Java - Log4j fixed file size setting example
less than 1 minute read
1
2
3
4
5
6
7
8
9
10
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 ] %- 5 p ( % F :% L ) - % m % n