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 <garydgreg...@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: garydgreg...@gmail.com | ggreg...@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

Reply via email to