tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Winfried Klum <k...@bison-soft.de>
Subject Re: log4j and tomcat
Date Mon, 07 May 2001 06:45:34 GMT
You can try the following:

 String propPath =
conf.getServletContext().getResource("/WEB-INF/classes/log4j.properties");
 PropertyConfigurator.configure(propPath);
 ...

 regards 
 Winfried 
> 
> Hello there!
> 
> I was wondering if anybody could help with a tomcat
> and log4j problem?
> 
> I have placed my log4j.properties file into my
> WEB-INF/classes direcotry but it seems that Tomcat is
> not picking it up!
> 
> This is the line in my code in my .java file taht
> tells me what .properties file to look for
> 
> PropertyConfigurator.configure("log4j.properties");
> 
> If I put in the full path to the .properties file, it
> still does not seem to find it!
> 
> It tells me the following the error message: (but the
> application in the browser works fine
> 
> log4j:ERROR Could not read configuration file
> [log4j.properties].
> java.io.FileNotFoundException: log4j.properties (No
> such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at
> java.io.FileInputStream.<init>(FileInputStream.java:64)
>         at
> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:289)
>         at
> org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:308)
>         at security.security.<init>(security.java:32)
>         at java.lang.Class.newInstance0(Native Method)
>         at java.lang.Class.newInstance(Class.java:237)
>         at
> java.beans.Beans.instantiate(Beans.java:207)
>         at java.beans.Beans.instantiate(Beans.java:51)
>         at
> jason.security._0002fjason_0002fsecurity_0002flogin_0005fhandler_0002ejsplogin_0005fhandler_jsp_0._jspService(_0002fjason_0002fsecurity_0002flogin_0005fhandler_0002ejsplogin_0005fhandler_jsp_0.java:68)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>         at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>         at
> org.apache.tomcat.core.Handler.service(Handler.java:286)
>         at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>         at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)
> log4j:ERROR Ignoring configuration file
> [log4j.properties].
> 
> any help is appreciated!
> Jason
> 
> --- Anuj Agrawal <agrawal@lucent.com> wrote: > Yes it
> can.
> >
> > You might want to consider creating a
> > log4j.properties file to hold your log4j
> > configuration.  Have that file in your
> > WEB-INF/classes dir and tomcat would
> > automatically pick it up.
> >
> > HTH.
> > Anuj.
> >
> > teh j wrote:
> >
> > > I have recently started playing with log4j. Does
> > > anybody know if it can be used with Tomcat?
> > > I have a a JSP app running on tomcat that has
> > several
> > > beans and classes and was wondering if I could use
> > > log4j as a logging tool
> >
> 
> _____________________________________________________________________________
> http://store.yahoo.com.au - Yahoo! Store
> - It's time you had your business online!

Mime
View raw message