So, DEBUG is used as a wrapper for the Category class, right? (name DEBUG seems 
confusing...)
Initializer for the DEBUG should take a class as input and whenever you instanciate 
DEBUG, pass "ClassName.class".
Inside of the initializer for the DEBUG class, initilize the Category class with 
Category.getInstance(ClassYouPassed).

hope that helps.
Noriaki


-----Original Message-----
From:   Rafal Kedziorski 
Sent:   Wednesday, October 17, 2001 3:43 PM
To:     Log4j Users Mailing List
Subject:        The best way?!

Hallo,

I want use log4j with EJB's and Servlets. For this I would define one DEBUG 
class based on Log4j Category, which should contains the same methods like 
Log4j Category. e.g.

// for servlets (the same for EJB's)
public BaseServlet extends HttpServlet {
     protected static DEBUG debug = new DEBUG();
     ...
}


public class DEBUG {
     ...

     DEBUG() {
         // initialize data
     }


     public final static void debug(String message) {
         cat.debug(message);
     }


     public final static void info(String message) {
         cat.info(message);
     }


     public final static void warn(String message) {
         cat.warn(message);
     }
}

DEBUG should be used by all classes and should load own PatternLayout. But 
if I call my debug in my log file I see DEBUG.java as caller.

Waht is the best solution for this?


Best Regards,
Rafal


---------------------------------------------------------------------
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