views:

303

answers:

1

Hello All

I am trying to extend RollingFileAppender so that it will rotate even when no messages are coming into the logging system. Normally the rollOver method is called when a message arrives and a time check is done to trigger the rotate.

My Version of RollingFileAppender will call rollOver every x seconds so that I am guaranteed a rotate even when no messages arrive.

Now my problem is that RollingFileAppender rollOver has an Access level modifier of no modifier. Thus I can't call it every x seconds like I wish to.

  /**
     Rollover the current file to a new file.
  */
  void rollOver() throws IOException {

Now looking at the code I can't figure out why it requires no modifer and I have decided to bring the class into my packages and call rollOver.

Now this feels dirty do I have any other alternatives if I want to call rollOver?

+1  A: 

You can of course do it using reflection.

Source code extracted from the trunk or from tag 1.2.15 : svn at apache

public // synchronization not necessary since doAppend is alreasy synched
void rollOver() {
  File target;
  ...

Do we speak about the same thing : log4j-1.2.15 ?

Matthieu BROUILLARD
Thanks Matthieu I'll take a look
Paul Whelan