commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [logging] problem with trace-level logging using log4j
Date Fri, 19 Sep 2003 20:44:28 GMT
On Fri, 19 Sep 2003, Sgarlata Matt wrote:

> Date: Fri, 19 Sep 2003 15:32:38 -0400
> From: Sgarlata Matt <sgarlata_matt@bah.com>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: commons-user@jakarta.apache.org
> Subject: [logging] problem with trace-level logging using log4j
>
> I may be missing something here or posting to the wrong list, but for some
> reason it seems that trace-level logging doesn't work correctly using
> commons logging 1.0.3 and log4j 1.2.8.  Sorry this is a long post but I am
> trying to give all info needed to diagnose the problem.
>
> I have this trace-level statement in my com.bah.krm.core.KrmFactory:
>
> if (log.isTraceEnabled())
> {
>  log.trace("Retrieving module " + cd + " from database");
> }
>
> This is producing debug-level output, which is curious since I am using
> trace:
>
> DEBUG [Thread-5] (KrmFactory.java:172) - Retrieving module TG from database
>
> Also, when I set my debugging level for this class to debug instead of
> trace, the message still shows up even though it should not.
>
> Here is my commons-logging.properties file:
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
> org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFac
> toryImpl
>
> Here is my log4j.properties file:
> log4j.rootLogger=error, stdout, R
>
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=/example.log
>
> log4j.appender.R.MaxFileSize=100KB
> log4j.appender.R.MaxBackupIndex=1
>
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>
> log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
>
> log4j.logger.com.bah.ebspnp=trace, R
> log4j.logger.com.bah.krm=trace, R
>
> log4j.logger.com.bah.krm.core.KrmFactory=debug, R
>
> Any idea what could be wrong?  Thanks,
>

Log4JLogger (in c-l) uses Priority.DEBUG (from Log4J) for both debug() and
trace() output.  Looking at the Log4J Javadocs, it seems that Log4J 1.2.8
doesn't expose any Priority (or Level) constant for trace-level
debugging, so that was the closest reasonable mapping.

> Matt

Craig

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


Mime
View raw message