logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Porting from 1.0 Logger.getLevel()
Date Mon, 24 Mar 2014 03:57:26 GMT
core.Logger has a getLevel method.  I think we should add getLevel to Logger in the API.  However,
there should not be a setter.

Ralph

On Mar 23, 2014, at 7:16 PM, Gary Gregory <garydgregory@gmail.com> wrote:

> In order to see how practical 2.0 is going to be for our large app server code base,
I branched it a while back and I have been porting.
> 
> One of the things we do is Logger.getLevel(). This is no longer in the 2.0 API.
> 
> I looks like we can add it by filling in the blanks in org.apache.logging.slf4j.SLF4JLogger.getLevel()
with a hack like:
> 
>     public Level getLevel() {
>         if (logger.isTraceEnabled()) {
>             return Level.TRACE;
>         }
>         if (logger.isDebugEnabled()) {
>             return Level.DEBUG;
>         }
>         if (logger.isInfoEnabled()) {
>             return Level.INFO;
>         }
>         if (logger.isWarnEnabled()) {
>             return Level.WARN;
>         }
>         if (logger.isErrorEnabled()) {
>             return Level.ERROR;
>         }
>         // Option: throw new IllegalStateException("Unknown SLF4JLevel");
>         // Option: return Level.ALL;
>         return Level.OFF;
>     }
> 
> Thoughts?
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory


Mime
View raw message