标签: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>
标签:log4j druid
原文地址:http://881206524.blog.51cto.com/10315134/1944569