druid log4j配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了druid log4j配置相关的知识,希望对你有一定的参考价值。
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:WARN No appenders could be found for logger (druid.sql.Connection).解决方法
log4j:WARN No appenders could be found for logger (druid.sql.Connection).解决方法
log4jspringboot项目启动 ,使用的druid数据源,log4j报错 log4j:WARN Please initialize the log4j system properly.(代码片
springboot+druid报错log4j:WARN No appenders could be found for logger (druid.sql.Connection). log4j:WA