logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Fletcher" <ja...@attask.com>
Subject DailyRollingFileAppender
Date Tue, 20 Apr 2004 23:13:47 GMT
Hello,

I am trying to create a DailyRollingFileAppender that will notify a set of
listeners after the file has rolled. Here is the situation. We are using
Oracle's TopLink as our persistence engine and JBoss as the application
server. We are using Log4J as our logging mechanism and we have setup a
custom JNDI Repository Selector to separate the JBoss logging from our
application. We are passing the Log4J log file to TopLink so that DB
messages can be logged.

This works fine until the log file rolls. TopLink has no idea that its
Writer is now invalid and we lose our DB logs. So the idea is to write a
custom appender that keeps a list of LogRollListeners and when the log file
rolls, it sends a Writer to the new log file to all of the potential
"listeners", including our TopLinkLogRollListener so that it can reset its
log destination file.

So here is the problem...

We want the functionality of the DailyRollingFileAppender, but it is not
subclassable from outside of the "org.apache.log4j" package due to the fact
that several of the member variables are private or package scope and even
the rollOver() method is declared as package scope. So we have resorted to
creating, basically, the same exact functionality as the
DailyRollingFileAppender in a completely new class to which we added our
small (6 lines) code.

Is there a better way to do this, or is this being addressed in future
versions of Log4J? Thanks for your help.

Jason Fletcher


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message