[logback-user] Any advice ? duplicate messages with only asinglelogger in the logger context.

Ceki Gulcu listid at qos.ch
Tue Apr 15 15:07:39 CEST 2008


Hello Paul,

It should be possible to isolate the LoggingContext used by SimpleSocketServer 
without impacting the rest of your application.

The main method in SimpleSocketServer looks like:

   public static void main(String argv[]) throws Exception {
     [snip] ...

     String configFile = argv[1];
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
     configureLC(lc, configFile);

     SimpleSocketServer sss = new SimpleSocketServer(lc, port);
     sss.start();
   }

you can change it to

public class MySimpleSocketServer {

   public static void main(String argv[]) throws Exception {
     [snip] ...
     LoggerContext lcOther = new LoggerContext();
     lcOther.setName("other");
     SimpleSocketServer.configureLC(lcOther, configFile);

     SimpleSocketServer sss = new SimpleSocketServer(lcOther, port);
     sss.start();
   }
}

Let us know if the above is not clear or not applicable to your environment.

Gibbons, P (Paul) wrote:
> Unfortunately the proposed solution does not work as it changes the default logger context for the whole application rather than just for those messages received by SocketNode.  
> 
> 

-- 
Ceki Gülcü
QOS.ch is looking to hire talented developers in Switzerland.  If
interested, please contact c e k i @ q o s . c h




More information about the Logback-user mailing list