commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesus M. Salvo Jr." <jesus.sa...@migasia.com>
Subject Re: [Commons-Logging] Using Commons-Logging with an older Log4J ( 1.1.3 )
Date Wed, 04 Jun 2003 00:02:44 GMT
Craig R. McClanahan wrote:

>On Tue, 3 Jun 2003, Jesus M. Salvo Jr. wrote:
>
>  
>
>>Date: Tue, 03 Jun 2003 17:52:53 +1000
>>From: Jesus M. Salvo Jr. <jesus.salvo@migasia.com>
>>Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
>>To: commons-user@jakarta.apache.org
>>Subject: [Commons-Logging] Using Commons-Logging with an older Log4J (
>>    1.1.3 )
>>
>>
>>I am using Commons-Logging against Log4J 1.1.3
>>
>>I use Commons-Logging like this:
>>
>>*) via System properties:
>>-Dlog4j.configuration=/export/softgame/app_gateway/prod/test/log4j.properties
>>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
>>
>>*) within source code:
>>    Log     logger = LogFactory.getLog( "SMimeFetcher" );
>>
>>I presume that the String passed in becomes the category name in Log4J.
>>The calls to info() does get outputted via Log4J, ... but they all get
>>logged to Log4J's root category!
>>
>>Interestingly though, I looked at the source code for
>>org.apache.commons.logging.impl.Log4JCategoryLog, and there is no
>>reference to Log4J's Category class, but instead it references Log4J's
>>Logger class.
>>
>>However, Log4J 1.1.3 did not yet have Log4J's Logger class. In short, I
>>would have expected it to NOT work, but it still did.
>>
>>    
>>
>
>Direct calls to Log4J will, of course, work fine as long as you use Log4J
>1.1 compatible APIs.  But for the commons-logging wrappers, this depends
>on your definition of "works".  
>

It was logging to the appender defined for the root category, which is a 
file named as /var/log/Unconfigured.log in the log4j.properties.

>Commons Logging decides whether
>Log4J is available by looking for the existence of the
>org.apache.log4j.Logger class in the class path available to your
>application.  If it's not there (as would be true in your case), Commons
>Logging will simply assume that Log4J is not available, and default to JDK
>1.4 logging (if you're using JDK 1.4) or SimpleLog (if you're not).
>  
>

OK ... So I must be using SimpleLog, since I am using JDK 1.3. I'll 
check again.

>  
>
>>Anyway ... is there any other alternative to reliably using
>>Commons-Logging against Log4J apart from upgrading to the latest Log4J?
>>
>>    
>>
>
>The Commons-Logging integrated support for Log4J requires Log4J 1.2 or
>later.
>

Thanks

>
>Craig
>
>  
>


Mime
View raw message