码迷,mamicode.com
首页 > 其他好文 > 详细

druid log4j配置

时间:2017-07-04 23:23:13      阅读:491      评论:0      收藏:0      [点我收藏+]

标签:log4j druid

1. druid配置中必须加上以下filter

<property name="filters" value="log4j" />


druid已封装好的filter

druid.filters.default=com.alibaba.druid.filter.stat.StatFilter

druid.filters.stat=com.alibaba.druid.filter.stat.StatFilter

druid.filters.mergeStat=com.alibaba.druid.filter.stat.MergeStatFilter

druid.filters.counter=com.alibaba.druid.filter.stat.StatFilter

druid.filters.encoding=com.alibaba.druid.filter.encoding.EncodingConvertFilter

druid.filters.log4j=com.alibaba.druid.filter.logging.Log4jFilter

druid.filters.slf4j=com.alibaba.druid.filter.logging.Slf4jLogFilter

druid.filters.commonlogging=com.alibaba.druid.filter.logging.CommonsLogFilter

druid.filters.commonLogging=com.alibaba.druid.filter.logging.CommonsLogFilter

druid.filters.wall=com.alibaba.druid.wall.WallFilter

druid.filters.config=com.alibaba.druid.filter.config.ConfigFilter


2.log4j.xml

 	<logger name="druid.sql" additivity="false">
        <level value="debug" />
		<appender-ref ref="console"/>
    </logger>
 	<logger name="druid.sql.DataSource" additivity="false">
        <level value="error" />
		<appender-ref ref="console"/>
    </logger>
 	<logger name="druid.sql.Connection" additivity="false">
        <level value="error" />
		<appender-ref ref="console"/>
    </logger>
 	<logger name="druid.sql.Statement" additivity="false">
        <level value="debug" />
		<appender-ref ref="console"/>
    </logger>
 	<logger name="druid.sql.ResultSet" additivity="false">
        <level value="debug" />
		<appender-ref ref="console"/>
    </logger>



druid log4j配置

标签:log4j druid

原文地址:http://881206524.blog.51cto.com/10315134/1944569

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!