commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <novo...@gridsphere.org>
Subject Re: commons-logging and log4j headaches
Date Thu, 07 Jun 2007 01:53:25 GMT

Hi Rodrigo,

    Thanks so much for the fast and accurate response! I'm not sure if 
putting the log4j.properties file in my application jar is such a great 
idea since it could cause weird things to happen if I distributed the 
jar as a library for others to use. But putting it in a conf directory 
seems like a good solution.

    Cheers, Jason

Rodrigo Canabrava wrote:
> Jason,
>
> you can't include a single properties file in the classpath with the
> -cp option. It expects directories, or jar files.
> You should put the properties file in some other directory (for
> example conf), and put this directory in the classpath. A better
> option is to put the log4j.properties file with your classes, inside
> the build/lib/stockstats-1.0.jar.
>
> Rodrigo
>
>
> 2007/6/6, Jason Novotny <novotny@gridsphere.org>:
>>
>> Hi,
>>
>> I'm trying to use log4j and commons-logging in the simplest app and I
>> get the infamous
>>
>> log4j:WARN No appenders could be found for logger
>> (org.stockstats.tools.UpdateSymbols).
>> log4j:WARN Please initialize the log4j system properly.
>>
>> In my classpath, I made sure I have commons-logging, log4j jars and my
>> log4j.properties file as follows and I even turned on log4j debugging
>> which claims that no log4j.properties file is found!
>>
>>
>> [fuzzmonkey:~/StockStats] novotny% java  -Dlog4j.debug -cp
>> lib/log4j.properties:lib/commons-codec-1.3.jar:lib/commons-httpclient-3.1-rc1.jar:lib/commons-logging-1.0.4.jar:lib/log4j.properties:lib/log4j-1.2.11.jar:build/lib/stockstats-1.0.jar:.

>>
>> org.stockstats.tools.Main
>> log4j: Trying to find [log4j.xml] using context classloader
>> sun.misc.Launcher$AppClassLoader@a9c85c.
>> log4j: Trying to find [log4j.xml] using
>> sun.misc.Launcher$AppClassLoader@a9c85c class loader.
>> log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
>> log4j: Trying to find [log4j.properties] using context classloader
>> sun.misc.Launcher$AppClassLoader@a9c85c.
>> log4j: Trying to find [log4j.properties] using
>> sun.misc.Launcher$AppClassLoader@a9c85c class loader.
>> log4j: Trying to find [log4j.properties] using
>> ClassLoader.getSystemResource().
>> log4j: Could not find resource: [null].
>> log4j:WARN No appenders could be found for logger
>> (org.stockstats.tools.UpdateSymbols).
>> log4j:WARN Please initialize the log4j system properly.
>>
>> The only way I can get it to work is if I explicitly add
>> -Dlog4configuration=file:///tmp/log4j.properties to specify the file
>> location. I just cannot see why it can't find it in the classpath when I
>> specified it explicitly.
>>
>> Thanks, Jason
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
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