You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Rafal Kedziorski <ra...@polonium.de> on 2001/10/17 22:18:01 UTC
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: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: The best way?!
Posted by Rafal Kedziorski <ra...@polonium.de>.
Hallo,
At 14:53 17.10.2001 -0600, you wrote:
>Define a Category with a name "DEBUG".
like
public class DEBUG extends Category {
}
Best Regards,
Rafal
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: The best way?!
Posted by T Master <tm...@iknowledgeinc.com>.
Define a Category with a name "DEBUG".
Then use that in your code.
Define your own Appender, with PatternLayout too.
Use a config file (xml, or properties based) to load this up.
Example ConsoleAppender with patternlayout.
log4j.appender.DestinationP=org.apache.log4j.ConsoleAppender
log4j.appender.DestinationP.Target=System.out
log4j.appender.DestinationP.layout=org.apache.log4j.PatternLayout
log4j.appender.DestinationP.layout.ConversionPattern=%c%m%n
----- Original Message -----
From: "Rafal Kedziorski" <ra...@polonium.de>
To: "Log4j Users Mailing List" <lo...@jakarta.apache.org>
Sent: Wednesday, October 17, 2001 2:18 PM
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: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org