You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Maxime Colas des Francs <ma...@hotmail.com> on 2002/10/01 18:08:42 UTC
log4j
How to use log4j with a tomcat application ?
I put the log4j.properties in WEB-INF/classes
No error but no file created (certainly rights ?)
Can i put some log in a directory of the webapp ?
Tks.
Re: log4j
Posted by Dan Lipofsky <da...@nuserve.com>.
Mine is in tomcat/bin.
Did you scan your drive to try and find it?
Try setting TOMCAT_OPTS="-Dlog4j.debug"
for tomcat3 (or use CATALINA_OPTS for tomcat 4).
It outputs lots of info which should at least show you
if the property file is getting parsed as you expect.
Also try adding a ConsoleAppender and see if you
see something on stdout (in tomcat4 you would find it
in logs/catalina.out).
You might also ask the log4j mailing list instead.
- Dan
----- Original Message -----
From: "Maxime Colas des Francs" <ma...@hotmail.com>
Sent: Tuesday, October 01, 2002 9:56 AM
> tks
> i'm sorry but where can i find the log file ?
>
> my logj4.properties in WEB-INF/classes:
> log4j.rootCategory=DEBUG, htmlFile
> log4j.appender.htmlFile.layout=org.apache.log4j.HTMLLayout
> log4j.appender.htmlFile=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.htmlFile.DatePattern='.'yyyy-MM-dd
> log4j.appender.htmlFile.File=myapp-log.html
>
> for a test in a jsp, i put these lines :
>
> Category log = Category.getInstance("LOG");
> PropertyConfigurator.configure("log4j.properties");
> log.info("log sentence");
>
> it's executed but no file created.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: log4j
Posted by Maxime Colas des Francs <ma...@hotmail.com>.
tks
i'm sorry but where can i find the log file ?
my logj4.properties in WEB-INF/classes:
log4j.rootCategory=DEBUG, htmlFile
log4j.appender.htmlFile.layout=org.apache.log4j.HTMLLayout
log4j.appender.htmlFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.htmlFile.DatePattern='.'yyyy-MM-dd
log4j.appender.htmlFile.File=myapp-log.html
for a test in a jsp, i put these lines :
Category log = Category.getInstance("LOG");
PropertyConfigurator.configure("log4j.properties");
log.info("log sentence");
it's executed but no file created.
tks
----- Original Message -----
From: "Dan Lipofsky" <da...@nuserve.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, October 01, 2002 12:30 PM
Subject: Re: log4j
> You have to call PropertyConfigurator.configure().
> I have a JSP which gets run when tomcat starts.
> It has a jspInit() method which calls an init class
> I wrote which initializes log4j like this:
>
> URL url = Init.class.getResource(filename);
> PropertyConfigurator.configure(url);
>
> To get tomcat to run the JSP at startup I have this in
> my web.xml
>
> <web-app>
> <servlet>
> <servlet-name>/Startup.jsp</servlet-name>
> <jsp-file>/Startup.jsp</jsp-file>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> ...
>
> </web-app>
>
> - Dan
>
> ----- Original Message -----
> From: "Maxime Colas des Francs" <ma...@hotmail.com>
> Sent: Tuesday, October 01, 2002 9:08 AM
>
> How to use log4j with a tomcat application ?
>
> I put the log4j.properties in WEB-INF/classes
> No error but no file created (certainly rights ?)
>
> Can i put some log in a directory of the webapp ?
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: log4j
Posted by Dan Lipofsky <da...@nuserve.com>.
You have to call PropertyConfigurator.configure().
I have a JSP which gets run when tomcat starts.
It has a jspInit() method which calls an init class
I wrote which initializes log4j like this:
URL url = Init.class.getResource(filename);
PropertyConfigurator.configure(url);
To get tomcat to run the JSP at startup I have this in
my web.xml
<web-app>
<servlet>
<servlet-name>/Startup.jsp</servlet-name>
<jsp-file>/Startup.jsp</jsp-file>
<load-on-startup>1</load-on-startup>
</servlet>
...
</web-app>
- Dan
----- Original Message -----
From: "Maxime Colas des Francs" <ma...@hotmail.com>
Sent: Tuesday, October 01, 2002 9:08 AM
How to use log4j with a tomcat application ?
I put the log4j.properties in WEB-INF/classes
No error but no file created (certainly rights ?)
Can i put some log in a directory of the webapp ?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>