I guess the best solution is to note it in the javadoc and then always return 
true.

Ralph

On Oct 22, 2012, at 9:12 AM, Gary Gregory wrote:

> So... throw an IllegalArgumentException? Seems harsh. If not an exception, 
> then returning true is the only option.
> 
> ?
> 
> Gary
> 
> On Mon, Oct 22, 2012 at 11:34 AM, Ralph Goers <ralph.go...@dslextreme.com> 
> wrote:
> I would suggest that isEnabled() specifically disallow Level.OFF as that 
> makes no sense.  The test for a level is 
> 
> intLevel <= level.intLevel.
> 
> It is impossible for a Logger to ever have a level that will make this result 
> false.
> 
> Ralph
> 
> 
> 
> 
> On Oct 22, 2012, at 7:11 AM, Gary Gregory wrote:
> 
>> Hi All:
>> 
>> I added a new API in Logger: isEnabled(Level), which should be like v1's 
>> Category.isEnabledFor(Priority).
>> 
>> It is implemented like this:
>> 
>>     public boolean isEnabled(Level level) {
>>         return isEnabled(level, null, (Object) null, null);
>>     }
>> 
>> I do not understand why this tests passes: 
>> org.apache.logging.log4j.LoggerTest.isOffEnabled()
>> 
>>     @Test
>>     public void isOffEnabled() {
>>         assertTrue("Incorrect level", logger.isEnabled(Level.OFF));
>>     }
>> 
>> Thoughts?
>> 
>> Gary
>> 
>> -- 
>> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 
>> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
>> Spring Batch in Action: http://bit.ly/bqpbCK
>> Blog: http://garygregory.wordpress.com 
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
> 
> 
> 
> 
> -- 
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org 
> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0
> Spring Batch in Action: http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Reply via email to