Jesse,

You might want to look at the SocketHubAppender that is part of the log4j
1.2 release.  Instead of actively seeking a target, it waits for clients to
connect to it.  Multiple clients can be supported.  But you will need to
modify the Lumbermill code to connect to the server you want.  Plans are
being made to add this functionality to Chainsaw and/or LogFactor5, both of
which are part of the log4j (I know chainsaw is included in v1.2, I don't
know about LF5).

let me know if you have any questions.
-Mark

> -----Original Message-----
> From: Jesse Vitrone [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 16, 2002 10:43 AM
> To: [EMAIL PROTECTED]
> Subject: adding / removing appenders dynamically
> 
> 
> 
> Lumbermill with Log4J looks great, but I don't want the 
> socket connector for
> Lumbermill to be running all the time, I'd like to be able to 
> hit a servlet
> at sets up the appender, then have Lumbermill connect to the 
> server and
> start showing the logging info.
> 
> I thought it would be easy to do, but I can't seem to get it 
> working right.
> My code looks like this:
> 
> public static final String LUMBERMILL_APPENDER_NAME = "LogServer";
> 
> public static boolean isLumbermillSocketAppenderRunning() {
>       Logger rootLog = Logger.getRootLogger();
>       Appender app = rootLog.getAppender(LUMBERMILL_APPENDER_NAME);
>       return (app != null);
> }
> 
> public static void startLumbermillSocketAppender () {
>       Logger rootLog = Logger.getRootLogger();
>       SocketAppender app = new SocketAppender("localhost", 4445);
>       app.setName(LUMBERMILL_APPENDER_NAME);
>       rootLog.addAppender(app);
> }
> 
> public static void stopLumbermillSocketAppender () {
>       Logger rootLog = Logger.getRootLogger();
>       rootLog.removeAppender(LUMBERMILL_APPENDER_NAME);
> }
> 
> the method to check if there is an appender with the name 
> LogServer works
> well, but the start and stop don't seem to do anything.
> 
> 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?
> 
> Thanks in advance,
>       Jesse Vitrone
> 
> 
> --
> 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