logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Log4j Issues with Appenders
Date Mon, 01 Oct 2007 04:25:06 GMT

On Sep 30, 2007, at 3:18 PM, kesharaju wrote:

> I am new to Log4j, and I am running into this issue.
> [9/30/07 15:56:23:718 EDT] 00000026 SystemErr     R log4j:ERROR  
> Could not
> instantiate class [com.ibm.logdemo.appender.JMSQueueAppender].
> [9/30/07 15:56:23:750 EDT] 00000026 SystemErr     R
> java.lang.ClassNotFoundException:  
> com.ibm.logdemo.appender.JMSQueueAppender
> [9/30/07 15:56:23:796 EDT] 00000026 SystemErr     R 	at
> java.lang.Class.forNameImpl(Native Method)
> [9/30/07 15:56:23:796 EDT] 00000026 SystemErr     R 	at
> java.lang.Class.forName(Class.java:131)
> [9/30/07 15:56:23:796 EDT] 00000026 SystemErr     R 	at
> org.apache.log4j.helpers.OptionConverter.instantiateByClassName 
> (OptionConverter.java:301)
> [9/30/07 15:56:23:796 EDT] 00000026 SystemErr     R 	at
> org.apache.log4j.helpers.OptionConverter.instantiateByKey 
> (OptionConverter.java:116)
> [9/30/07 1
> My log4j configuration is as follows..
> #Sets the root level to DEBUG, which means every log message will be
> displayed
> log4j.rootCategory=DEBUG, A1
> #Next we set the Category to the Appender
> log4j.appender.A1=com.ibm.logdemo.appender.JMSQueueAppender
> #Next we set the Category to the Layout
> log4j.appender.A1.layout=com.ibm.logdemo.message.XMLLayout
> Looks like, for some reason log4j is not able to find my appender  
> class. I
> think my appender and log4j are being loaded by different class  
> loaders. Can
> you please help?

 From the class names you are using, it appears that you are trying  
to use the sample code provided with IBM Developerworks article from  
2002: http://www.ibm.com/developerworks/websphere/library/ 
techarticles/0207_barcia/barcia.html.  As you surmised, the messages  
from log4j are indicating that the com.ibm.logdemo.* classes could  
not be found.  If you are attempting to use a custom appender, you  
will have to do something to make it available to the class loader.   
You have told us nothing about the actions that you took that would  
make you expect that the sample code from that article would be  
available to the class loader.  You have told us nothing about your  
environment (JRE or app server name and version, operating system,  
any configuration options) that would allow us to try to diagnose  
your problem.

I don't have any familiarity with that code, but it is tutorial-grade  
code from 2002 and it is likely to be not ready for production use,  
not compatible with log4j 1.2 or both.  It may be better for you to  
tell us what you want to do.  Is there a particular reason why you  
would not want to use the JMSAppender provided with log4j?

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message