You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Francesco Russo <f....@cineca.it> on 2004/09/28 11:14:43 UTC

logger.getLevel() returning null

Hi everybody,
using log4j1.2.8 I am facing a strange behaviour. Follows a snippet of 
my configuration file:

    <logger name="it.cineca.sia.frk.commons" additivity="false">
      <!-- Valori ammessi: DEBUG, INFO, WARN, ERROR, FATAL, OFF, ALL -->
      <level value="DEBUG"/>
      <!-- Riportare uno o piu' appender verso cui indirizzare i log -->
      <appender-ref ref="sia.frk.appender.dailyFile"/>
    </logger>

    <logger name="it.cineca.test" additivity="false">
      <!-- Valori ammessi: DEBUG, INFO, WARN, ERROR, FATAL, OFF, ALL -->
      <level value="DEBUG"/>
      <!-- Riportare uno o piu' appender verso cui indirizzare i log -->
      <appender-ref ref="sia.frk.appender.dailyFile"/>
    </logger>

    <root>
      <appender-ref ref="sia.frk.appender.console"/>
    </root>

Let us now suppose I have a class called it.cineca.test.j2eeLog.LoggingBean.
Well, whenever I call "Logger.getLogger(LoggingBean.class)" I get a 
Logger instance whose inner Level instance is null!
While whenever I call "Logger.getLogger("it.cineca.test")" everything 
works fine.
Why?! Any hints?

Thanks in advance,

-- 
______________________________________________________
Francesco Russo
CINECA - Interuniversitary Computing Centre
via Magnanelli, 6/3
40033 Casalecchio di Reno (Bologna) - ITALY
e-mail: f.russo@cineca.it
Phone: +39 051 6171 775

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


Re: logger.getLevel() returning null

Posted by Francesco Russo <f....@cineca.it>.
Thanks, that was the solution.

Ceki Gülcü wrote:
> 
> The Logger.getLevel method can return null. You are probably looking for 
> the Logger.getEffectiveLevel method.
> 
> http://logging.apache.org/log4j/docs/api/org/apache/log4j/Category.html#getEffectiveLevel() 
> 
> 
> At 11:14 AM 9/28/2004, you wrote:
> 
>> Hi everybody,
>> using log4j1.2.8 I am facing a strange behaviour. Follows a snippet of 
>> my configuration file:
>>
>>    <logger name="it.cineca.sia.frk.commons" additivity="false">
>>      <!-- Valori ammessi: DEBUG, INFO, WARN, ERROR, FATAL, OFF, ALL -->
>>      <level value="DEBUG"/>
>>      <!-- Riportare uno o piu' appender verso cui indirizzare i log -->
>>      <appender-ref ref="sia.frk.appender.dailyFile"/>
>>    </logger>
>>
>>    <logger name="it.cineca.test" additivity="false">
>>      <!-- Valori ammessi: DEBUG, INFO, WARN, ERROR, FATAL, OFF, ALL -->
>>      <level value="DEBUG"/>
>>      <!-- Riportare uno o piu' appender verso cui indirizzare i log -->
>>      <appender-ref ref="sia.frk.appender.dailyFile"/>
>>    </logger>
>>
>>    <root>
>>      <appender-ref ref="sia.frk.appender.console"/>
>>    </root>
>>
>> Let us now suppose I have a class called 
>> it.cineca.test.j2eeLog.LoggingBean.
>> Well, whenever I call "Logger.getLogger(LoggingBean.class)" I get a 
>> Logger instance whose inner Level instance is null!
>> While whenever I call "Logger.getLogger("it.cineca.test")" everything 
>> works fine.
>> Why?! Any hints?
>>
>> Thanks in advance,
>>
>> -- 
>> ______________________________________________________
>> Francesco Russo
>> CINECA - Interuniversitary Computing Centre
>> via Magnanelli, 6/3
>> 40033 Casalecchio di Reno (Bologna) - ITALY
>> e-mail: f.russo@cineca.it
>> Phone: +39 051 6171 775
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 

-- 
______________________________________________________
Francesco Russo
CINECA - Interuniversitary Computing Centre
http://www.cineca.it
via Magnanelli, 6/3
40033 Casalecchio di Reno (Bologna) - ITALY
e-mail: f.russo@cineca.it
Phone: +39 051 6171 775

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


Re: logger.getLevel() returning null

Posted by Ceki Gülcü <ce...@qos.ch>.
The Logger.getLevel method can return null. You are probably looking for 
the Logger.getEffectiveLevel method.

http://logging.apache.org/log4j/docs/api/org/apache/log4j/Category.html#getEffectiveLevel()

At 11:14 AM 9/28/2004, you wrote:
>Hi everybody,
>using log4j1.2.8 I am facing a strange behaviour. Follows a snippet of my 
>configuration file:
>
>    <logger name="it.cineca.sia.frk.commons" additivity="false">
>      <!-- Valori ammessi: DEBUG, INFO, WARN, ERROR, FATAL, OFF, ALL -->
>      <level value="DEBUG"/>
>      <!-- Riportare uno o piu' appender verso cui indirizzare i log -->
>      <appender-ref ref="sia.frk.appender.dailyFile"/>
>    </logger>
>
>    <logger name="it.cineca.test" additivity="false">
>      <!-- Valori ammessi: DEBUG, INFO, WARN, ERROR, FATAL, OFF, ALL -->
>      <level value="DEBUG"/>
>      <!-- Riportare uno o piu' appender verso cui indirizzare i log -->
>      <appender-ref ref="sia.frk.appender.dailyFile"/>
>    </logger>
>
>    <root>
>      <appender-ref ref="sia.frk.appender.console"/>
>    </root>
>
>Let us now suppose I have a class called it.cineca.test.j2eeLog.LoggingBean.
>Well, whenever I call "Logger.getLogger(LoggingBean.class)" I get a Logger 
>instance whose inner Level instance is null!
>While whenever I call "Logger.getLogger("it.cineca.test")" everything 
>works fine.
>Why?! Any hints?
>
>Thanks in advance,
>
>--
>______________________________________________________
>Francesco Russo
>CINECA - Interuniversitary Computing Centre
>via Magnanelli, 6/3
>40033 Casalecchio di Reno (Bologna) - ITALY
>e-mail: f.russo@cineca.it
>Phone: +39 051 6171 775
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  



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