See the patch in https://issues.apache.org/jira/browse/LOG4J2-576 which contains other supporting code.
Gary On Sun, Mar 23, 2014 at 10: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<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 > -- E-Mail: garydgreg...@gmail.com | ggreg...@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