Mark - thanks for all your help.  It turns out that the original code I had
was good, but I was picking up a beta log4j jar file and that was causing
the problem.  Once I switched to the real 1.2 jar everything worked great.

Jesse

-----Original Message-----
From: Mark Womack [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 16, 2002 4:20 PM
To: 'Log4J Users List'
Subject: RE: adding / removing appenders dynamically


You don't have different instances of log4j do you?  Where does your log4j
jar live?  In the application classpath or the container classpath?

Also, I think the activateOptions() and cleanUp() methods might be called by
add/removeAppender, and may not be needed in your code.  Might want to look
at the source to see.

-Mark

> -----Original Message-----
> From: Jesse Vitrone [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 16, 2002 1:02 PM
> To: Log4J Users List
> Subject: RE: adding / removing appenders dynamically
>
>
> hmmm....seems that what I'm doing isn't really taking effect.
>
> If I start with the socket appender getting started at startup:
>    I check and it's there
>    I remove it
>    I check and it's gone
>    I do something that requires logging
>       it gets to Lumbermill
>    I check and the socket appender is back!
>
> If I start with out the socket appender:
>    I check and it's not there
>    I add it
>    I check and it's there
>    I do something that requires logging
>        it doesn't get to Lumbermill
>    I check and the socket appender isn't there anymore!
>
> Any idea what's going on?  Do I have to save the Logger or
> something like
> that?  Should I not be changing the logger, but something else?
>
> I also tried adding the appender to the logger with
> BasicConfigurator, but
> that didn't work either.
>
> Thanks in advance,
>    Jesse
>
> -----Original Message-----
> From: Jesse Vitrone [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 16, 2002 2:44 PM
> To: Log4J Users List
> Subject: RE: adding / removing appenders dynamically
>
>
> Mark, thanks for all your suggestions, but I'm still having no luck.
> My code now looks like this:
>
>     public static void startLumbermillSocketAppender () {
>         Logger rootLog = Logger.getRootLogger();
>         SocketAppender app = new SocketAppender("localhost", 4445);
>         app.setName(LUMBERMILL_APPENDER_NAME);
>         app.activateOptions();
>         rootLog.addAppender(app);
>     }
>
>     public static void stopLumbermillSocketAppender () {
>         Logger rootLog = Logger.getRootLogger();
>         SocketAppender app = (SocketAppender)
> rootLog.getAppender(LUMBERMILL_APPENDER_NAME);
>         app.cleanUp();
>         app.close();
>         rootLog.removeAppender(app);
>     }
>
> neither of these seem to have any effect on what gets logged.
>
> If Lumbermill is started already, I can do a
> rootLog.getAllAppenders(), and
> when I loop through them, I see that "LogServer" is one of
> them.  When I
> call my stop method, then check the rootLog.getAllAppenders again,
> "LogServer" is no longer one of the appenders, but Lumbermill is still
> getting new logging info, which makes me think the appender
> hasn't really
> been stopped.
>
> Jesse
>
> -----Original Message-----
> From: Mark Womack [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 16, 2002 2:28 PM
> To: 'Log4J Users List'
> Subject: RE: adding / removing appenders dynamically
>
>
> > Even when I start up the socket appender in the
> log4j.properties (and
> > lumbermill works properly), I can't get it to stop with my
> > stop method. Any
> > ideas?
>
> Try calling the cleanUp() method on the appender.
>
> -Mark"
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


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


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

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


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

Reply via email to