Skip to content

Instantly share code, notes, and snippets.

@aruld
Last active April 11, 2024 01:25
Show Gist options
  • Save aruld/c998d72158efde334db8 to your computer and use it in GitHub Desktop.
Save aruld/c998d72158efde334db8 to your computer and use it in GitHub Desktop.
Must have Time and Size Log4J appender for your application http://aruld.info/must-have-time-and-size-log4j-appender-for-your-application/
log4j.rootLogger=DEBUG,rollingByDate
# logfile is set to be a TimeAndSizeRollingAppender. Keep 100 backup files before rotating and rolling daily, compression set to GZ
log4j.appender.rollingByDate=uk.org.simonsite.log4j.appender.TimeAndSizeRollingAppender
log4j.appender.rollingByDate.File=/logs/app.log
log4j.appender.rollingByDate.RollOnStartup=true
log4j.appender.rollingByDate.DateRollEnforced=true
log4j.appender.rollingByDate.Threshold=DEBUG
log4j.appender.rollingByDate.DatePattern=.yyyy-MM-dd
log4j.appender.rollingByDate.MaxFileSize=10MB
log4j.appender.rollingByDate.MaxRollFileCount=100
log4j.appender.rollingByDate.ScavengeInterval=30000
log4j.appender.rollingByDate.BufferedIO=false
log4j.appender.rollingByDate.CompressionAlgorithm=GZ
log4j.appender.rollingByDate.CompressionMinQueueSize=5
log4j.appender.rollingByDate.layout=org.apache.log4j.PatternLayout
log4j.appender.rollingByDate.layout.ConversionPattern=%-5p %-23d{ISO8601} [%t] %x: %c{1} - %m%n
@zj619
Copy link

zj619 commented Apr 11, 2024

I cannot find TimeAndSizeRollingAppender on http://www.simonsite.org.uk or maven repository, can you send it to me the code of uk.org.simonsite.log4j.appender.TimeAndSizeRollingAppender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment