Friday, 1 July 2011

I have been thinking for a little while now that the name of the package in which the TimeAndSizeRollingAppender (TASRA) lives is perhaps inappropriate.  From its original inception back in 2008, through successive releases to date, the TASRA has lived in the package org.apache.log4j.appender.  However, development of the TASRA is neither sponsored nor otherwise supported by the Apache Foundation: the code is not bundled with any Log4J distros, it is not managed within an Apache repository, nor is there any reference to it on the Apache websites outside of forum postings and JIRA items that refer to it.  The only connection with Apache is the fact that the TASRA is distributed under the Apache 2.0 license.

At a technical level, a user recently requested a change of package name such that the TASRA could be more readily deployed within a JBoss environment.  I have no experience of JBoss, nor the use of signed JARs which drove the user’s particular request.  However, this has provided a concrete reason to change the name of the package within which the TASRA will reside.

Provided there is no significant objection from users all future releases the TASRA will live in the package.

For most users, the only difference will be that configuration must change to use the new fully-qualified class name (  For advanced users, import declarations will need to be updated and code recompiled.  Outside of that the TASRA will continue to work as before.

I intend to make this change soon.


James Holland said...

Good idea as it makes it easier to differentiate from any issues.

James Holland said...

Hi Simon,

I’m think of making some additions to your appenders for my own use; I will obviously make all source fully available.

What I’m think of doing is for every rollover file created generate a signature for it; thus it can be verified later. The appender would require configuration with a PEM certificate (in a keystore) so it contains the private key. This means that anyone can then verify with the public certificate.

I’d like to do this at rollover and should include all the appender compression strategies including the log/gzip/zip. So the questions I have are where would you recommend I inject this? Would it be better to just extend a LogFileCompressionStrategy compress method and add here? Or would you recommend elsewhere?

Also I'd need to extend the configuration to define the keystore,password, cert alias and cert password. I think that I just need to add this to AppenderRollingProperties, correct?


Simon said...

Hi James,

As discussed over email the way to do this is via listeners. A FileRollEventListener interface is already available, however it is currently package private and there are some problems with timing. I am working on solving the problems with it and figuring out how to integrate this with Log4J's DOMConfigurator. I'll blog again when I have something ready.

crb said...

Hello,it is possible to get a jar with the new package structure?

Simon said...

Hi crb,

I'm working on better support for FileRollEventListener in the TASRA at the moment. I have a first cut of the code but need to do some more testing before I'm happy with it. Once this is ready for release I'll probably put out the new package structure at the same time.

Simon said...

Hi James,

Check out the new release. I think this contains what you need but of course I'm always open to suggestions for improvement.

Best Regards,


Simon said...

The ActiveAsynchronousAppender and the TimeAndSizeRollingAppender now reside in the package.

aijperson said...

Hi simon,
I am glad to hear about TimeAndSizeRollingAppender, but the link is not available now. Please post other links.

Thank you for your contribution.

Leslie Lim said...

Wow. Awesome article. Please do more articles like this in the future. Very informational and knowledgeable. I will expect more from you in the future. For now i will just bookmark your page and surely I'm gonna come back later to read more. Thank you to the writer!