Java Logger with Servlets

Posted by Sunny on Stack Overflow See other posts from Stack Overflow or by Sunny
Published on 2010-04-09T18:33:58Z Indexed on 2010/04/09 18:43 UTC
Read the original article Hit count: 408

Filed under:
|
|

Hi Guys,

I am using a wrapper class A which initializes the java.util.logger

static class A {

    public static Logger logger;

    public static void init(){

    logger = Logger.getLogger("test");

}

Now, everywhere in my program I call A.init() and then logger.log("Message+uniqid"). But recently I moved to HTTP servlets and I am having problems.

Basically, If a app is already running and the logger is logging... and someone else runs the app again, the logger from the previous instance stops and starts logging for the second one. Can anyone have a solution to how I should go about fixing this static variable issue?

I can pass the logger into all constructor classes but thats really tedious. Any better solution would be appreciated..

© Stack Overflow or respective owner

Related posts about java

Related posts about logging