struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Selim Hendrickson <selimhendrick...@iyte.edu.tr>
Subject Re: Using Log4j in Struts 1.1
Date Thu, 08 Jul 2004 14:31:52 GMT
Hi,

You have to put the log4j.jar into the lib directory. Then you construct 
the log4j.properties file and put into the classes directory.
Here is a sample log4j.properties file:

log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.logger.org.apache.struts=DEBUG
log4j.logger.projectName=DEBUG
log4j.appender.stdout.layout.ConversionPattern=[%5p] %d{mm:ss} 
(%F:%M:%L)%n%m%n%n

import org.apache.commons.logging.Log and 
org.apache.commons.logging.LogFactory;

Then use: private static Log log = LogFactory.getLog(nameOfAction.class);

Anywhere you want to print a log message use:

log.trace("Your Message");

That should be all...

Take a look at the structure of the log4.properties file to find out 
about patterns and log levels. (DEBUG, WARN, etc.)
Pay attention that log.trace() is a certain log level and can be 
log.debug() as well. Take a look at the API.

Hope that helps,

Selim HENDRICKSON

IZTEK Consulting Services
Software Engineer
selimhendrickson [at] iyte.edu.tr
0232 750 6557

alok.garg@pharma.novartis.com wrote:

>Hello All,
>Can anybody send me the steps to config Log4j in struts1.1. Using 
>commons-logging
>
>Regards,
>Alok Garg
>
>  
>




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


Mime
View raw message