logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Re: Porting from 1.0 Logger.getLevel()
Date Mon, 24 Mar 2014 04:22:28 GMT
+1 for getLevel but no setLevel.


On 23 March 2014 22:57, Ralph Goers <ralph.goers@dslextreme.com> wrote:

> 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<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
Matt Sicker <boards@gmail.com>

Mime
View raw message