My mistake, the close method is getting called and just once. What I was
seeing was that when I init'd log4j amy appender was created and then when I
setup the watchdog that appender was destroyed and then created again...thus
I though the close metyhod was getting called "a lot".

It seems to get called only once if I dont use the watchdog.

Mike

----- Original Message -----
From: "Mike Dougherty" <[EMAIL PROTECTED]>
To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, June 03, 2001 4:12 PM
Subject: Re: Final Rollover for files when log4j is shutdown


> Ceki Gülcü wrote:
> >
> > At 15:10 03.06.2001 -0700, you wrote:
> > >Mike Papper wrote:
> > >>
> > >> I use the call to Category.shutdown to stop log4j. I have my own
appender
> > >> (which is a subclass of RollingFileAppender)
> > >> and want to "rollover" that appender when log4j is shutdown. I cannot
seem
> > >> to find a method to override that lets me know when log4j is going
away so I
> > >> can initiate a rollover.
> > >>
> > >> Is there a way?
> > >>
> > >> Note that overriding finalize or the close method will not work.
> > >>
> > >> Mike Papper
> > >> [EMAIL PROTECTED]
> > >>
> > >
> > >It looks like the Appender that you are using needs to implement the
> > >org.apache.log4j.spi.AppenderAttachable interface. For some reason
> > >shutdown process only calls the close() method on the Appender if it is
> > >an instance AppenderAttachable. I can't tell you why this is true, but
> > >it is. Maybe someone else on the list can help me understand. Otherwise
> > >I would have to say it's a bug.
> >
> > Hello Mike,
> >
> > You mean Hierarchy.shutdown()? This method closes all appenders. Why
> > do you say that it only closes AppenderAttachables? Regards, Ceki
> >
> >
>
> On line 282 (in the closeNestedAppenders method) of Category.java
> there's a conditional that checks to see if the Appender is an instance
> of AppenderAttachable before it calls the close method. I'm pretty sure
> I got the latest code since I just checked it out last night.
>
> You're right it is the Hierarchy.shutdown() method that gets the root
> and any current Categories and then calls the closeNestedAppenders()
> method on each Category, right?
>
> /mike
>
> P.S. I'm new to this list so I hope I am not overstepping my bounds.
>
>
> --
> ******************************************
>  Mike Dougherty -- Java Software Engineer
> ******************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to