Skip to content

Commit c02d817

Browse files
committed
Merge pull request #539 from emotion/master
Update logging.xml
2 parents 2c9dfea + f1609ee commit c02d817

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/site/zh/xdoc/logging.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,24 @@
5959
WebSphere的环境中——WebSphere提供了Commons Logging的私有实现,你的Log4J配置将被忽略。
6060
这种做法不免让人悲催,MyBatis怎么能忽略你的配置呢?事实上,因Commons Logging已经存
6161
在了,按照优先级顺序,Log4J自然就被忽略了!不过,如果你的应用部署在一个包含Commons Logging的环境,
62-
而你又想用其他的日志框架,你可以根据需要调用如下的某一方法:
62+
而你又想用其他的日志框架,你可以通过在MyBatis的配置文件mybatis-config.xml里面添加一项setting(配置)来选择一个不同的日志实现。
63+
</p>
64+
<source><![CDATA[<configuration>
65+
<settings>
66+
...
67+
<setting name="logImpl" value="LOG4J"/>
68+
...
69+
</settings>
70+
</configuration>]]>
71+
</source>
72+
<p>
73+
logImpl可选的值有:SLF4J、LOG4J、LOG4J2、JDK_LOGGING、COMMONS_LOGGING、STDOUT_LOGGING、NO_LOGGING
74+
或者是实现了接口<code>org.apache.ibatis.logging.Log</code>的类的完全限定类名,
75+
并且这个类的构造函数需要是以一个字符串(String类型)为参数的。
76+
(可以参考org.apache.ibatis.logging.slf4j.Slf4jImpl.java的实现)
77+
</p>
78+
<p>
79+
你根据需要调用如下的某一方法:
6380
</p>
6481
<source><![CDATA[org.apache.ibatis.logging.LogFactory.useSlf4jLogging();
6582
org.apache.ibatis.logging.LogFactory.useLog4JLogging();

0 commit comments

Comments
 (0)