tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Wishnie" <j...@deluxebiz.com>
Subject Re: log4j
Date Tue, 01 Oct 2002 17:13:39 GMT
I use Log4j with Tomcat with no problems.

I do _not_ explicitly initialize a configurator. I simply do the following:

1. Place log4j.properties in:
$MY_WEB_APP_HOME/WEB-INF/classes

2. Create a 'logs' directory in my WEB-INF

3.  EXPLICITLY set a FULL path for the log file in the properties file as follows:
log4j.appender.A1.File=/this/is/a/full/path/MY_WEB_APP/WEB-INF/logs

If, like me, you deploy your app to many different locations, you can use a build and deploy
tool like Ant to dynamically write out
the full path on deploy. So my actual properties file looks like this:

log4j.appender.A1.File=@logfile@

On deploy, Ant substitutes the actual full path for "@logfile@"

- jeff

----- Original Message -----
From: "Januski, Ken" <kjanuski@phillynews.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Tuesday, October 01, 2002 10:04 AM
Subject: RE: log4j


> You might want to take a look at this:
> http://jakarta.apache.org/log4j/docs/manual.html
> to get an overview of log4j.
>
> I'd tell you more but I'm still trying to digest it, and how I can use it in
> Tomcat, myself.
>
>
> -----Original Message-----
> From: Maxime Colas des Francs [mailto:max_sts@hotmail.com]
> Sent: Tuesday, October 01, 2002 12:57 PM
> To: Tomcat Users List
> Subject: Re: log4j
>
>
> 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" <danlip@nuserve.com>
> To: "Tomcat Users List" <tomcat-user@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" <max_sts@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:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message