tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Gordon <adam.gor...@readytalk.com>
Subject Re: Logging individual web applications
Date Tue, 04 Mar 2008 19:24:29 GMT
Neha-

First, I assume you meant to say the WEB-INF/classes directory as that's 
where the log4j.properties file needs to be placed for a given web app.

Second, you probably don't want to set the rootLogger to DEBUG as any 
libraries you use could potentially be affected by this and if you've 
ever used Apache libraries before, their verbose logging is VERY 
verbose...  a better way is to set it to INFO, and then define any 
package specific loggers ala:

log4j.rootLogger=INFO, cc1

# lock down apache logging to only INFO or higher
log4j.logger.org.apache=INFO

# lock down quartz logging to only INFO or higher
log4j.logger.org.quartz=INFO

# webapp specific loggers
log4j.logger.com.foo.bar=TRACE

Thirdly, I don't see the threshold set anywhere (and I don't know what 
the default is), ala:
log4j.threshold=ALL

This level basically dictates the lowest level of logging that is to be 
permitted by ALL loggers so it should be set to the finest level possible.

If none of this helps, pull the log4j.properties file out of your webapp 
and just write a test java class that uses it and prints out a logging 
statement at each level.  This way you don't have to restart your webapp 
every time you tweak your properties file to get it working.  Use a 
log4j provided Appender so you don't have to muck with your custom one.  
If it works right away, w/ no other modifications to the appender 
definition, then the problem lies within your custom appender.

HTH,

--adam

Neha Agrawal wrote:
> Hello
>        i have configured log4j for system logging in
> Tomcat5.5 .Als othe log is rotating..
> Now iwant to configure my individual web-apps using
> log4j
> i have copied log4j.jar and common-logging.jar and the
> Date-File-appender.jar files in the web-apps lib
> directory and also created log4j.properties file in
> the webapps classes directory..
> how do i configure this log4j.properties?
> i used the following configuration, but nothing is
> being logged by my webapp..
>
> log4j.rootLogger=DEBUG,S
> log4j.appender.S=biz.minaret.log4j.DatedFileAppender
> log4j.appender.S.layout=org.apache.log4j.PatternLayout
> log4j.appender.S.layout.ConversionPattern=%d [%t] %-5p
> %c - %m%n
>
> log4j.appender.S.Directory=/usr/share/tomcat5.5.25/webapps/sample/logs
>
> log4j.appender.S.Prefix=sample.
>
> # Suffix: The log file name suffix.
> log4j.appender.S.Suffix=.log
>
> Is some thing wrong in this?
> Thanks
> nEha
>
>
>       Why delete messages? Unlimited storage is just a click away. Go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message