logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Sawatzky <jeff.sawat...@locationary.com>
Subject Re: slf4j, log4j and PropertyConfigurator.configure
Date Thu, 07 Jun 2012 15:08:47 GMT
Ah, good catch!

log4j was being automatically initialized once from the log4j.properties in the war. Then,
when I load the multiple property files and combine them (which I use commons configuration
to do) it was converting the "INFO, stdout" from a string to an array.

I've now escaped the "," in my properties file and it seems to work fine now.

Thanks again!

Jeff.

On 2012-06-07, at 4:26 AM, ceki wrote:

> Hello Jeff,
> 
> From the messages log4j outputs at configuration time, it very much
> looks like the root logger is defined twice with the second definition
> with no appender. Hence the "log4j:WARN No appenders could be found
> for logger (com.loca.util.services.AppListener)" message.
> 
> HTH,
> -- 
> Ceki
> http://twitter.com/#!/ceki
> 
> On 07.06.2012 00:26, Jeff Sawatzky wrote:
> 
> > I have a project where I am using slf4j with the log4j binder, and I
> > am trying to configure log4j with the PropertyConfigurator.  The
> > project allows for a common log4.properties file and a machine
> > log4j.properties file, and at start up I load the two files, combine
> > them into a Properties object, and then pass them to
> > PropertyConfigurator.configure. But when I try to log using slf4j I
> > get a "log4j:WARN No appenders could be found for logger" error on the
> > class I am trying to log from.
>> 
>> In my app startup I have..
>> 
>> Properties props = //do work.......
>> LogManager.resetConfiguration();
>> PropertyConfigurator.configure(props);
>> 
>> but here is the output (with log4j.debug turned on)
>> log4j: Parsing for [root] with value=[INFO, stdout].
>> log4j: Level token is [INFO].
>> log4j: Category root set to INFO
>> log4j: Parsing appender named "stdout".
>> log4j: Parsing layout options for "stdout".
>> log4j: Setting property [conversionPattern] to [%-4r [%t] %-5p %c %x - %m%n].
>> log4j: End of parsing for "stdout".
>> log4j: Parsed "stdout" options.
>> log4j: Finished configuring.
>> log4j: Parsing for [root] with value=[INFO].
>> log4j: Level token is [INFO].
>> log4j: Category root set to INFO
>> log4j: Finished configuring.
>> log4j:WARN No appenders could be found for logger (com.loca.util.services.AppListener).
>> log4j:WARN Please initialize the log4j system properly.
>> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
>> 
>> Shouldn't the logger for com.loca.util.services.AppListener use the root appender
that was configured?
>> 
>> Thanks!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


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


Mime
View raw message