Lets have a look at the org.ops4j.pax.logging.cfg of the latest distribution of Fuse ESB, which is currently 4.4.1-fuse-03-06. The Sift appender comes configured as follows:
# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=servicemix
log4j.appender.sift.appender=org.apache.log4j.FileAppender
log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n
log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true
To enable a rolling log file we need to change:
log4j.appender.sift.appender=org.apache.log4j.FileAppender
to: log4j.appender.sift.appender=org.apache.log4j.RollingFileAppender
Then we need to add the following properties to enable the rolling log:
log4j.appender.sift.appender.maxFileSize=10MB
log4j.appender.sift.appender.maxBackupIndex=10
Of course you would configure these properties as required by your application.
Now the Sift appender configured for rolling log files should look as follows:
# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=servicemix
log4j.appender.sift.appender=org.apache.log4j.RollingFileAppender
log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n
log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true
log4j.appender.sift.appender.maxFileSize=10MB
log4j.appender.sift.appender.maxBackupIndex=10
That's all there is to it. You now have a Sift appender configured for rolling log files. Just remember you also need to have the rootLogger configured as follows to ensure the sift appender is activated.
Note: This is found at the top of the org.ops4j.pax.logging.cfg file.
log4j.rootLogger=INFO, sift, osgi:VmLogAppender