You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Dean A. Hoover" <dh...@rochester.rr.com> on 2003/07/01 01:16:19 UTC

tomcat and log4j

I want to use log4j inside a tomcat application. According
to the log4j short manual, all I have to do is drop my
log4j.properties file into WEB-INF/classes and then I can
just use it. This does not seem to be working. Can someone
help?

Thanks.

Dean Hoover


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


Re: tomcat and log4j

Posted by Holger Klawitter <li...@klawitter.de>.
Am Dienstag, 1. Juli 2003 02:03 schrieb Dean A. Hoover:
> Thanks for responding. I'm just going by what it says in the log4j
> manual:
>
> "The default log4j initialization is particularly useful in web-server
> environments. Under Tomcat 3.x and 4.x, you should place the
>
> |log4j.properties| under the |WEB-INF/classes| directory of your
>
> web-applications. Log4j will find the properties file and initialize
> itself. This is easy to do and it works."

> log4j.appender.roll=org.apache.log4j.RollingFileAppender
> log4j.appender.roll.File=xxx.log
> log4j.appender.roll.MaxFileSize=100KB
> log4j.appender.roll.MaxBackupIndex=1
> log4j.appender.roll.layout=org.apache.log4j.PatternLayout
> log4j.appender.roll.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n

The file might be written to a weird directory or couldn't be written at all. 
You should try an absolute path, like

log4j.appender.roll.File=${catalina.home}/logs/xxx.log

Mit freundlichem Gruß / With kind regards
	Holger Klawitter
--
lists <at> klawitter <dot> de


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


Re: tomcat and log4j

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
Thanks for responding. I'm just going by what it says in the log4j
manual:

"The default log4j initialization is particularly useful in web-server 
environments. Under Tomcat 3.x and 4.x, you should place the 
|log4j.properties| under the |WEB-INF/classes| directory of your 
web-applications. Log4j will find the properties file and initialize 
itself. This is easy to do and it works."

I am running jakarta-tomcat-4.1.24 on RH 9 using j2sdk1.4.1_02. I just 
did a jar tvf on my
war file, which shows:

[dhoover@falcon vendor]$ jar tvf build/vendor.war
     0 Mon Jun 30 03:52:20 EDT 2003 META-INF/
   110 Mon Jun 30 03:52:20 EDT 2003 META-INF/MANIFEST.MF
     0 Wed May 14 01:06:28 EDT 2003 images/
     0 Mon Jun 30 01:48:54 EDT 2003 include/
     0 Mon Jun 30 13:26:16 EDT 2003 css/
  1210 Wed May 14 01:06:28 EDT 2003 login.jsp
   485 Fri Jun 27 15:32:30 EDT 2003 welcome.jsp
  3008 Wed May 14 01:06:28 EDT 2003 images/email2.png
 15284 Wed May 14 01:06:28 EDT 2003 images/email.jpg
  1678 Mon Jun 30 02:16:40 EDT 2003 register2.jsp
  6861 Mon Jun 30 01:48:54 EDT 2003 include/contactinfo.jspf
  2287 Wed May 14 01:06:28 EDT 2003 contact.html
   435 Fri Jun 27 15:38:58 EDT 2003 index.html
   856 Mon Jun 30 13:25:12 EDT 2003 css/default.css
  1729 Mon Jun 30 01:55:04 EDT 2003 register1.jsp
  1181 Mon Jun 30 01:54:14 EDT 2003 register3.jsp
     0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/
     0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/classes/
  3526 Mon Jun 30 02:58:14 EDT 2003 WEB-INF/classes/Login.class
  7268 Mon Jun 30 03:03:26 EDT 2003 WEB-INF/classes/Register.class
   333 Mon Jun 30 03:00:06 EDT 2003 WEB-INF/classes/log4j.properties
     0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/lib/
 45386 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/activation.jar
305434 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/mail.jar
352668 Wed Jun 25 14:53:02 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar
 97589 Fri May 16 01:45:42 EDT 2003 WEB-INF/lib/universal-common.jar
 12844 Fri Jun 27 03:06:54 EDT 2003 WEB-INF/lib/xxx.jar
352668 Mon Jun 30 03:52:06 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar
  1800 Wed May 21 09:53:30 EDT 2003 META-INF/context.xml
   496 Wed May 14 02:08:08 EDT 2003 WEB-INF/web.xml

This is what my log4j.properties file looks like:
log4j.rootLogger=DEBUG, roll

log4j.appender.roll=org.apache.log4j.RollingFileAppender
log4j.appender.roll.File=xxx.log
log4j.appender.roll.MaxFileSize=100KB
log4j.appender.roll.MaxBackupIndex=1
log4j.appender.roll.layout=org.apache.log4j.PatternLayout
log4j.appender.roll.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n

Everything compiles. I've used log4j in non-web apps. I have log statements
in my servlet, and I cannot find a log file anywhere. What's up with that???

Yoav Shapira wrote:

>Howdy,
>It does work if you place logj4.properties in WEB-INF/classes and log4j.jar in
>WEB-INF/lib.  If you could please be a bit more explicity when you say "This
>does not seem to be working" perhaps I could help more.
>
>Yoav Shapira
>
>--- "Dean A. Hoover" <dh...@rochester.rr.com> wrote:
>  
>
>>I want to use log4j inside a tomcat application. According
>>to the log4j short manual, all I have to do is drop my
>>log4j.properties file into WEB-INF/classes and then I can
>>just use it. This does not seem to be working. Can someone
>>help?
>>
>>Thanks.
>>
>>Dean Hoover
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>=====
>Yoav Shapira
>yoavs@computer.org
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>http://sbc.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>



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


Re: tomcat and log4j

Posted by Yoav Shapira <yo...@yahoo.com>.
Howdy,
It does work if you place logj4.properties in WEB-INF/classes and log4j.jar in
WEB-INF/lib.  If you could please be a bit more explicity when you say "This
does not seem to be working" perhaps I could help more.

Yoav Shapira

--- "Dean A. Hoover" <dh...@rochester.rr.com> wrote:
> I want to use log4j inside a tomcat application. According
> to the log4j short manual, all I have to do is drop my
> log4j.properties file into WEB-INF/classes and then I can
> just use it. This does not seem to be working. Can someone
> help?
> 
> Thanks.
> 
> Dean Hoover
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


=====
Yoav Shapira
yoavs@computer.org

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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