【发布时间】:2012-12-09 21:52:29
【问题描述】:
如何确定给定项目使用什么日志系统?
它有log4j、slf4j和logback的标志。看起来活动配置文件是log4j.properties。记录器是由
private static Logger log = LoggerFactory.getLogger(MyClass.class);
记录器的完整类型是org.slf4j.Logger,工厂类型是org.slf4j.LoggerFactory。
但也有罐子logback-core-0.9.26.jar和logback-classic-0.9.26.jar。
其他罐子是slf4j-log4j12-1.6.1.jar、slf4j-api-1.6.1.jar、log4j-1.2.16.jar和commons-logging-1.1.1.jar。
是什么定义了logback 显然是不活动的?如何激活?
【问题讨论】:
-
查找所有 slf4j 罐子。它可能会将 log4j 桥接到 slf4j
-
还要检查确切的类路径。不是所有的罐子都在里面
-
"the type of factory is org.slf4j.LoggerFactory"
-
如果类路径中确实存在 logback-classic.jar 和 slf4j-log4j12.jar,则 SLF4J 将打印控制台的警告消息。但是,您没有提到任何此类消息。
标签: java log4j slf4j logback apache-commons-logging