原因:Mybatis默认使用slf4j输出日志,需要增加slf4j对log4j的驱动jar包。
分析
请自行看下mybatis “
org.apache.ibatis.logging.LogFactory ”类源码,为了使读者更直观了解原因,笔者摘了LogFactory 部分代码。
</pre><pre name="code" class="java">public final class LogFactory {
/**
* Marker to be used by logging implementations that support markers
*/
public static final String MARKER = "MYBATIS";
private static Constructor<? extends Log> logConstructor;
static {
tryImplementation(new Runnable() {
@Override
public void run() {
useSlf4jLogging();
}
});
tryImplementation(new Runnable() {
@Override
public void run() {