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

[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to