Configure maxFileSize and maxBackupIndex with DailyRollingFileAppender.
Issue
-
We're running fuse 6.3.0 with a fabric and want to fuse.log to rotate on a daily basis. I have configured org.ops4j.pax.logging.cfg based on documentation https://access.redhat.com/solutions/1146033. We've noticed logs rotate only is the log has been updated/written to. Is that the expected behavior?
-
Also, according to the documentation I see both settings bellow are not included in the configuration when configured for daily log rotation. Can either or both settings below be used in conjunction with log4j.appender.out=org.apache.log4j.DailyRollingFileAppender configuration? In other words can log retention be configured along with daily log rotations?
log4j.appender.out.maxFileSize=100MB
log4j.appender.out.maxBackupIndex=30
- Here's my configuration...
# File appender
log4j.appender.out=org.apache.log4j.DailyRollingFileAppender
log4j.appender.out.layout=org.apache.log4j.SanitizingPatternLayout
log4j.appender.out.layout.replaceRegex=\\n
log4j.appender.out.layout.replacement=\\\\n |\u0020
log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
# use this for source code lines enabled in the logs (beware it impacts performance)
#log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
# use this for source code lines enabled and full thread and class names
#log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | {%t} [%C] (%F:%L) | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
log4j.appender.out.file=${runtime.data}/log/fuse.log
log4j.appender.out.append=true
#log4j.appender.out.maxFileSize=100MB
#log4j.appender.out.maxBackupIndex=30
log4j.appender.out.DatePattern='.'yyyy-MM-dd
Environment
- Red Hat Fuse
- 6.3.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.