logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Steppe <kste...@pacbell.net>
Subject Re: Basic question about log4j
Date Mon, 14 Jan 2002 22:32:48 GMT

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.


To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message