从commons logger获取底层log4 logger
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从commons logger获取底层log4 logger相关的知识,希望对你有一定的参考价值。
This snippet shows how to get access to the underlying log4j logger when using apache commons logging.
if(logger instanceof Log4JLogger) { Log4JLogger log4j = (Log4JLogger)logger; Logger underlyingLogger = log4j.getLogger(); underlyingLogger.setLevel(Level.INFO); underlyingLogger.addAppender(new ConsoleAppender( new PatternLayout("%-5p [%t]: %m%n"))); }
以上是关于从commons logger获取底层log4 logger的主要内容,如果未能解决你的问题,请参考以下文章
log4j中Logger.getLogger与LogFactory.getLog的区别