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 Srinivas <va...@yahoo.co.in> on 2004/06/07 08:15:01 UTC

Please Help me.... How to Implement Log4j.....

Hi Friends,

I have Configured the Log4j in my Application and in my lib/ 
log4j-1.2.8.jar put the jar file. When I run this application i am 
getting 

the Error..

I am putting log4j.jar file to web-inf/lib and log4j.properties and log4j.xml files are put into WEB-INF/classes ..

That is ...................

javax.servlet.ServletException: Servlet execution threw an exception



root cause
java.lang.NoClassDefFoundError: org/apache/log4j/Logger 
com.i2t2.mt.prod.action.LoginAction.<clinit>(LoginAction.java:17) 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method) 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
java.lang.reflect.Constructor.newInstance(Constructor.java:274) 
java.lang.Class.newInstance0(Class.java:308) 
java.lang.Class.newInstance(Class.java:261) 
org.apache.struts.util.RequestUtils.applicationInstance
RequestUtils.java:231) 
org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326) 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268) 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:856)



note The full stack trace of the root cause is available in the Tomcat 
logs.



This is the Error I am getting now...

Please Help me to solve this problem....

Thanks

Srinivas

Yahoo! India Matrimony: Find your partner online.

Re: Please Help me.... How to Implement Log4j.....

Posted by Jacob Kjome <ho...@visi.com>.
At 03:03 PM 6/7/2004 +0100, you wrote:
>Hi Jake ,
>
>Thanks for replay to me , It's working  well .
>But i am getting the message 2 times at the console ie Tomcat Server Console.

Normally this is caused by adding an appender to the root logger and then 
adding another appender to a named logger that inherits from the root 
logger.  To avoid that situation, you can use additivity=false on the named 
logger (see list archives for exact syntax in properties files).  However, 
I only see you adding one appender below, so I'm not sure why the message 
should be spit out twice?  Anyone else catch something I'm missing?


Jake


>I am using Tomcat 5x and JBuilder. And one more thing I have put the 
>log4j.properties file at WEB-INFO\classes..
>
>log4j.properties file is...................
>
># Default Logging Configuration
>
>log4j.rootLogger=DEBUG, stdout
>
>#to increase logging level
>
>#log4j.logger.org.dcm4cheri=DEBUG
>
>#to decrease logging level
>
>#log4j.logger.org.dcm4cheri=ERROR
>
>
>log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>
>
>log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>
>
>log4j.appender.stdout.layout.ConversionPattern=%-5p : %m%n
>
>
>What is the wrong i am doing?????
>Please tell me...
>
>Thanks
>Srinivas
>
>Jacob Kjome <ho...@visi.com> wrote:
>Where do you have commons-logging.jar? Struts uses it and it causes lots
>of problems like this because it is able to find Log4j using classloading
>tricks, but then not able to do classloading of Log4j it finds because it
>is in an inaccessible classloader. Put commons-logging in WEB-INF/lib
>along with log4j.jar and things should start working again. Make sure to
>use commons-logging.jar, not commons-logging-api.jar (which doesn't
>container the Log4j implementation).
>
>Jake
>
>At 07:15 AM 6/7/2004 +0100, you wrote:
> >Hi Friends,
> >
> >I have Configured the Log4j in my Application and in my lib/
> >log4j-1.2.8.jar put the jar file. When I run this application i am
> >getting
> >
> >the Error..
> >
> >I am putting log4j.jar file to web-inf/lib and log4j.properties and
> >log4j.xml files are put into WEB-INF/classes ..
> >
> >That is ...................
> >
> >javax.servlet.ServletException: Servlet execution threw an exception
> >
> >
> >
> >root cause
> >java.lang.NoClassDefFoundError: org/apache/log4j/Logger
> >com.i2t2.mt.prod.action.LoginAction.(LoginAction.java:17)
> >sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> >Method)
> >sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAc 
> cessorImpl.java:39)
> >
> >sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConst 
> ructorAccessorImpl.java:27)
> >
> >java.lang.reflect.Constructor.newInstance(Constructor.java:274)
> >java.lang.Class.newInstance0(Class.java:308)
> >java.lang.Class.newInstance(Class.java:261)
> >org.apache.struts.util.RequestUtils.applicationInstance
> >RequestUtils.java:231)
> >org.apache.struts.action.RequestProcessor.processActionCreate(RequestProc 
> essor.java:326)
> >
> >org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
> >org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
> >org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
> >javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> >
> >
> >
> >note The full stack trace of the root cause is available in the Tomcat
> >logs.
> >
> >
> >
> >This is the Error I am getting now...
> >
> >Please Help me to solve this problem....
> >
> >Thanks
> >
> >Srinivas
> >
> >Yahoo! India Matrimony: Find your partner online.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>Yahoo! India Matrimony: Find your partner online.


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


Re: Please Help me.... How to Implement Log4j.....

Posted by Srinivas <va...@yahoo.co.in>.
Hi Jake ,
 
Thanks for replay to me , It's working  well .
But i am getting the message 2 times at the console ie Tomcat Server Console. I am using Tomcat 5x and JBuilder. And one more thing I have put the log4j.properties file at WEB-INFO\classes..
 
log4j.properties file is...................
 
# Default Logging Configuration 
 
log4j.rootLogger=DEBUG, stdout 
 
#to increase logging level 
 
#log4j.logger.org.dcm4cheri=DEBUG 
 
#to decrease logging level 
 
#log4j.logger.org.dcm4cheri=ERROR 
 
 
log4j.appender.stdout=org.apache.log4j.ConsoleAppender 
 
 
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 
 
 
log4j.appender.stdout.layout.ConversionPattern=%-5p : %m%n


What is the wrong i am doing?????
Please tell me...
 
Thanks
Srinivas

Jacob Kjome <ho...@visi.com> wrote:
Where do you have commons-logging.jar? Struts uses it and it causes lots 
of problems like this because it is able to find Log4j using classloading 
tricks, but then not able to do classloading of Log4j it finds because it 
is in an inaccessible classloader. Put commons-logging in WEB-INF/lib 
along with log4j.jar and things should start working again. Make sure to 
use commons-logging.jar, not commons-logging-api.jar (which doesn't 
container the Log4j implementation).

Jake

At 07:15 AM 6/7/2004 +0100, you wrote:
>Hi Friends,
>
>I have Configured the Log4j in my Application and in my lib/
>log4j-1.2.8.jar put the jar file. When I run this application i am
>getting
>
>the Error..
>
>I am putting log4j.jar file to web-inf/lib and log4j.properties and 
>log4j.xml files are put into WEB-INF/classes ..
>
>That is ...................
>
>javax.servlet.ServletException: Servlet execution threw an exception
>
>
>
>root cause
>java.lang.NoClassDefFoundError: org/apache/log4j/Logger
>com.i2t2.mt.prod.action.LoginAction.(LoginAction.java:17)
>sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>Method)
>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
>
>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
>
>java.lang.reflect.Constructor.newInstance(Constructor.java:274)
>java.lang.Class.newInstance0(Class.java:308)
>java.lang.Class.newInstance(Class.java:261)
>org.apache.struts.util.RequestUtils.applicationInstance
>RequestUtils.java:231)
>org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326) 
>
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>
>
>
>note The full stack trace of the root cause is available in the Tomcat
>logs.
>
>
>
>This is the Error I am getting now...
>
>Please Help me to solve this problem....
>
>Thanks
>
>Srinivas
>
>Yahoo! India Matrimony: Find your partner online.


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

Yahoo! India Matrimony: Find your partner online.

Re: Please Help me.... How to Implement Log4j.....

Posted by Jacob Kjome <ho...@visi.com>.
Where do you have commons-logging.jar?  Struts uses it and it causes lots 
of problems like this because it is able to find Log4j using classloading 
tricks, but then not able to do classloading of Log4j it finds because it 
is in an inaccessible classloader.  Put commons-logging in WEB-INF/lib 
along with log4j.jar and things should start working again.  Make sure to 
use commons-logging.jar, not commons-logging-api.jar (which doesn't 
container the Log4j implementation).

Jake

At 07:15 AM 6/7/2004 +0100, you wrote:
>Hi Friends,
>
>I have Configured the Log4j in my Application and in my lib/
>log4j-1.2.8.jar put the jar file. When I run this application i am
>getting
>
>the Error..
>
>I am putting log4j.jar file to web-inf/lib and log4j.properties and 
>log4j.xml files are put into WEB-INF/classes ..
>
>That is ...................
>
>javax.servlet.ServletException: Servlet execution threw an exception
>
>
>
>root cause
>java.lang.NoClassDefFoundError: org/apache/log4j/Logger
>com.i2t2.mt.prod.action.LoginAction.<clinit>(LoginAction.java:17)
>sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>Method)
>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
>
>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
>
>java.lang.reflect.Constructor.newInstance(Constructor.java:274)
>java.lang.Class.newInstance0(Class.java:308)
>java.lang.Class.newInstance(Class.java:261)
>org.apache.struts.util.RequestUtils.applicationInstance
>RequestUtils.java:231)
>org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326) 
>
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>
>
>
>note The full stack trace of the root cause is available in the Tomcat
>logs.
>
>
>
>This is the Error I am getting now...
>
>Please Help me to solve this problem....
>
>Thanks
>
>Srinivas
>
>Yahoo! India Matrimony: Find your partner online.


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