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 Hu <xw...@yahoo.com> on 2002/01/14 21:30:05 UTC

Basic question about log4j

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 -D option to
specify the file, should it auto reload when the
confiration file changed? I can't get it work.

3. The message in LoggingEvent is private access, for
my situation, I need to put the timestamp in the
message and in the appender I need to access the
message to get the timestamp to create the file. And
remove the timestamp when the actual logging happens.
So is there any way to modify the message itself?

Thanks


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Basic question about log4j

Posted by Hu <xw...@yahoo.com>.
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 long, and then log the process
result, where the time is the process time.

Thanks

--- Kevin Steppe <ks...@pacbell.net> wrote:
> 
> 
> 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 configurator classes use the setXXX/getXXX
> methods, supply those and
> don't worry about the extra constructors.
> 
> >
> > 2. I use xml configuration file and use -D option
> to
> > specify the file, should it auto reload when the
> > confiration file changed? I can't get it work.
> >
> 
> you need to use a 'configureAndWatch' method.  Look
> in the javadoc for the
> config class.
> Note that the configure and watch architecture is
> changing for log4j 1.2
> 
> >
> > 3. The message in LoggingEvent is private access,
> for
> > my situation, I need to put the timestamp in the
> > message and in the appender I need to access the
> > message to get the timestamp to create the file.
> And
> > remove the timestamp when the actual logging
> happens.
> > So is there any way to modify the message itself?
> >
> 
> The LoggingEvents automaticly get a timestamp
> attached.  Use a pattern layout
> object to pull that out, it's much less work than
> what you suggest.
> 
> Kevin
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Basic question about log4j

Posted by Hu <xw...@yahoo.com>.
Thanks. I use watch dog now. but after I downloaded
log4j1.2, I could not see the architecture changes for
the watch dog, could you kindly point out?

--- Kevin Steppe <ks...@pacbell.net> wrote:
> 
> 
> 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 configurator classes use the setXXX/getXXX
> methods, supply those and
> don't worry about the extra constructors.
> 
> >
> > 2. I use xml configuration file and use -D option
> to
> > specify the file, should it auto reload when the
> > confiration file changed? I can't get it work.
> >
> 
******************************************

> you need to use a 'configureAndWatch' method.  Look
> in the javadoc for the
> config class.
> Note that the configure and watch architecture is
> changing for log4j 1.2
> 
> >
> > 3. The message in LoggingEvent is private access,
> for
> > my situation, I need to put the timestamp in the
> > message and in the appender I need to access the
> > message to get the timestamp to create the file.
> And
> > remove the timestamp when the actual logging
> happens.
> > So is there any way to modify the message itself?
> >
> 
> The LoggingEvents automaticly get a timestamp
> attached.  Use a pattern layout
> object to pull that out, it's much less work than
> what you suggest.
> 
> Kevin
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Basic question about log4j

Posted by Kevin Steppe <ks...@pacbell.net>.

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 configurator classes use the setXXX/getXXX methods, supply those and
don't worry about the extra constructors.

>
> 2. I use xml configuration file and use -D option to
> specify the file, should it auto reload when the
> confiration file changed? I can't get it work.
>

you need to use a 'configureAndWatch' method.  Look in the javadoc for the
config class.
Note that the configure and watch architecture is changing for log4j 1.2

>
> 3. The message in LoggingEvent is private access, for
> my situation, I need to put the timestamp in the
> message and in the appender I need to access the
> message to get the timestamp to create the file. And
> remove the timestamp when the actual logging happens.
> So is there any way to modify the message itself?
>

The LoggingEvents automaticly get a timestamp attached.  Use a pattern layout
object to pull that out, it's much less work than what you suggest.

Kevin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>