Log4J Appenders

TimeAndSizeRollingAppender Downloads

Appender

Each JAR comes complete with source and classes compiled for Java 1.4.2.

Later releases have been compiled and tested with Log4J 1.2.15, 1.2.16, and 1.2.17. Earlier releases, up to and including release 20100717-1237-1.2.9, have been compiled and tested with Log4J 1.2.9, 1.2.11, 1.2.12, 1.2.13, and 1.2.15.

20150607-2059 Release (Latest) log4j-rolling-appender-20150607-2059.jar
Donations The Appenders available on this site are written, tested, and supported entirely in my spare time. So please...
Change Log
  • Fixed NPE in TASRA equals(). Thanks to Larry West.
  • Reduced object construction during rollover (regression).
  • Hardened FileHelper utility against null parameters.
  • Updated ANT build to use Log4J 1.2.17 for Javadoc generation.
  • Added unit test.
  • Update Maven POM.
Test Results JUnit results and EMMA code coverage
Resources Maven2 POM file

20140925-0909 Release log4j-rolling-appender-20140925-0909.jar
Change Log
  • Fixed serious bug that prevented correct rollover operation on Java 1.4.
  • Update Maven POM.

20131024-2017 Release log4j-rolling-appender-20131024-2017.jar
Change Log
  • Added capability to flush to storage via java.io.FileDescriptor.
  • Added unit test.
  • Debug instead of warning messages in SimpleLoggingTaskExecutorService.
  • Update Maven POM.

20130711-2159 Release log4j-rolling-appender-20130711-2159.jar
Change Log
  • Fixed issue wherein a logging task executor shared by multiple appenders could be shut down when only one appender was closed, thereby preventing background log file compression and scavenging.
  • Added unit test.

20130708-2234 Release log4j-rolling-appender-20130708-2234.jar
Change Log
  • Worked-around a thread-safety issue in the Log4J 1.2.x FileAppender.setFile(4-param) method: there was a case wherein, if multiple Appenders were being created at the same time, programatically, the files were all in the same directory, and the directory did not yet exist, each thread would attempt to create the parent directory; one thread would win, therefore the other thread(s) would fail to initialise the file for writing.
  • File roll code calls File.getAbsolutePath() instead of File.getAbsoluteFile() during filename concatenation, thereby avoiding construction of an intermediate File object.
  • Updated Maven POM file to use Log4J 1.2.17 dependency.

20130130-1840 Release log4j-rolling-appender-20130130-1840.jar
Change Log
  • Added logging task executor services to manage thread count, initially for log file scavengers and backup file compressors.
  • Added check for InterruptedIOException.
  • Fixed an initialisation bug for log file scavenger.
  • Changed LogFileScavenger interface method signature to include throws clauses.
  • Added in some debug.
  • Removed Apache copyright notice.
  • Added missing Apache 2.0 licenses into some source files.

20120703-0826 Release log4j-rolling-appender-20120703-0826.jar
Change Log
  • Tested against Log4J 1.2.17.
  • Reduced object creation at rollover and during scavenging.

20120425-2221 Release log4j-rolling-appender-20120425-2221.jar
Change Log
  • Moved actual file roll code out of the FileRollable implementations' superclass and into the new FileRoller class
  • Removed FileRollEventListener methods from the FileRollable interface to the new FileRollEventSource interface implemented by FileRoller
  • Simplified constructors that took both TASRA and AppenderRollingProperties to accept only TASRA as a parameter
  • TimeSuffixHelper no longer synchronized; creates a new DateFormat on each access

20120412-1340 Release log4j-rolling-appender-20120412-1340.jar
Change Log
  • Changed package name from org.apache.log4j.appender to uk.org.simonsite.log4j.appender.

Deprecated Releases

20120411-1907 Release log4j-rolling-appender-20120411-1907-1.2.15.jar
Change Log
  • Added support for the configuration of TimeZones for use with daily, weekly, etc rolling strategies.
  • Added support for FileRollEventListeners configured via XML (present in the previous release and now officially supported).
  • Added support for FileCompressionEventListeners configured via XML.
  • Improved handling of headers and footers.
  • Reduced object creation at rollover and during scavenging.
  • Added missing support for annual rollover strategy.
  • Added unit tests.

20120206-1607 Release log4j-rolling-appender-20120206-1607-1.2.15.jar
Change Log
  • Fixed bug that caused duplicate footers to be written on close.
  • Changed artifactId property in Maven POM file to log4j-rolling-appender.
  • Expanded unit test coverage

20110725-1953 Release log4j-rolling-appender-20110725-1953-1.2.15.jar
Change Log
  • Reduced object construction and some redundant looping at rollover
  • Fixed bugs in the with-args constructors that caused NullPointerExceptions
  • Expanded unit test coverage

20110405-2024 Release log4j-rolling-appender-20110405-2024-1.2.15.jar
Change Log
  • Fixed ordering bug in backup log file sort caused by date parser leniency
  • Fixed thread safety bug in time-based log roll enforcement that may have caused multiple rollovers
  • Fixed thread safety bug in time-based log roll enforcement that could cause rollover attempts after appender close
  • Refactored time-based roll code to initialise eagerly and shorten the code path during each append
  • Expanded unit test coverage
  • A little refactoring to tidy up the design

20110222-0830 Release log4j-rolling-appender-20110222-0830-1.2.15.jar
Change Log
  • Reduced object construction at rollover

20110208-1953 Release log4j-rolling-appender-20110208-1953-1.2.15.jar
Change Log
  • Fixed a scavenger bug that prevented older files from being deleted if the DatePattern had been changed (e.g. between releases of an application)
  • Added Bernd's documentation to his contributed AbsoluteMinFreeDiskSpaceLogFileScavenger
  • Reduced object construction at rollover
  • Minimised regex pattern matching at rollover and during scavenging
  • Stopped the FileHelper from unnecessarily logging stack traces in the event that a file had been scavenged and could not therefore be read
  • Removed the test classes from the distributed JAR file (available on request)
  • Hardened the SynchronizedCountingQuietWriter against null Strings passed by a Layout
  • SynchronizedCountingQuietWriter catches java.io.InterruptedIOExceptions and sets the interrupt flag