Hi, I am new to log4j. I have some basic questions
about log4j.
1. In what kind of situation the constructor of
appenders that takes parameter will be called? if I
have my own appender that added more params, should I
creat the corresponding constructor?
2. I use xml configuration file and use
I am responsible for defining standards around how our developers use Log4J.
When our company started using Log4J a couple of months ago, I told
developers to use this technique in their code:
public class MyClass {
private static final Category LOG =
Easy.
What I did was this:
Define a class that has methods to log under differerent Categories:
e.g.
MyLogger
{
Category good = Category.getInstance(GOOD);
Category error = Category.getInstance(ERROR);
public void logGood( String msg){ good.info(msg); }
public void
T Master
This kind of intrusive wrapping around Log4j categories have been discussed
and disapproved on this mailinglist numerous times. I'm sure you can see
why.
A true generic wrapping around an underlying log provider would have to
utilize interfaces, factories and adapters to real
At 15:39 14.01.2002 -0500, you wrote:
That all worked fine, except that developers would make the mistake of
putting the wrong class name inside the getInstance() method. This would
usually happen when they would cut and paste code.
The idea of automatically discovering the caller class name
Getting information from the stack trace will be much easier in JDK 1.4
with the new Throwable class. The stack trace is represented as an array
which you can get reliable data out of.
Too bad JDK 1.4 is lagging WAY BEHIND! Any idea when it will be
released?
Chris
-Original Message-
Hu wrote:
Hi, I am new to log4j. I have some basic questions
about log4j.
1. In what kind of situation the constructor of
appenders that takes parameter will be called? if I
have my own appender that added more params, should I
creat the corresponding constructor?
Since the
Thanks a lot.
1.So the constructor with parameter is not used at
all?
2. Then that requires I call
DOMConfigurator.configureAndWatch(..) in the code, not
for using -D option
3. Well, the timestamp I need is far before the
logging happens. I need to do the process first, the
process maybe takes
Plus the nested LocationInfo object will now be incorrect if you ever want
to use it because. Basically the LocationInfo will now show this new
delegate class information as opposed to the actual class doing the
logging.
- Original Message -
From: Silvert, Stan [EMAIL PROTECTED]
To: