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 Bob Liu <bl...@theocc.com> on 2002/10/04 00:53:05 UTC
config log4j customized appender
I just started using Log4J 1.2.6. I developed a new appender called
MyAppender extending from org.apache.log4j.AppenderSkeleton.
And I tested by doing the following in my Java code and it worked.
MyLogger myLogger =
(MyLogger)MyLogger.getLogger(MyLogTest.class.getName());
MyAppender c = new MyAppender;
myLogger.addAppender(c);
myLogger.info("test message");
I can see the message in the destination MyAppender. (I tested on a
normal console and MQ)
Now I want to put it in the configuration properties file.
If I use log4j's appender it work as the following.
log4j.rootCategory=ERROR, dest1
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{MMM dd HH:MM:SS} %l %t
%c %p %m%n
But the following configuration doesn't work.
log4j.rootCategory=ERROR, dest1
log4j.appender.dest1=MyAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{MMM dd HH:MM:SS} %l %%c
%p %m%n
The error message is og4j:ERROR Could not instantiate class [MyAppender]
The interesting thing is I also developed a customized layout called
MyLayout. (extends from org.apache.log4j.Layout)
The following configuration worked.
og4j.rootCategory=ERROR, dest1
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=MyLayout
I wonder why it could instantiate MyLayout this time.
Thanks.
Bob Liu
The OCC
bliu@theocc.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Log4j Version
Posted by Daniel Serodio <da...@checkforte.com.br>.
Extract the contents of the jar file and look at the manifest
(MANIFEST.MF) file. It should have a "Implementation-Version:" line.
On Fri, 2002-10-04 at 01:46, Manish Gupta wrote:
> Is there any way to check the version of log4j. I have so many log4j.jar
> files and wants to know their versions.
>
>
> Regards.
> Manish Gupta.
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
[]'s
Daniel Serodio
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Log4j Version
Posted by Manish Gupta <mg...@asapsolutions.com>.
Is there any way to check the version of log4j. I have so many log4j.jar
files and wants to know their versions.
Regards.
Manish Gupta.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>