c3p0 连接池的日志配置

2022-08-27 10:56:57 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

如果用c3p0的话,经常会看到控制台上报一个警告,具体内容不急得了,大意是无法初始化MLog日志,请初始化log4j 出现此种情况是因为使用的c3p0这个连接池,并且没有正确配置其日志,只要把下面这段加到log4j.properties中即可

##################################################################################### #c3p0 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=OFF,A1 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=SEVERE,A1 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=WARNING,A1 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=INFO,A2 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=CONFIG,A2 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=FINE,A2 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=FINER,A2 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=FINEST,A2 log4j.category.com.mchange.v2.log.log4j.Log4jMLog=ALL,A2

#c3p0 appender log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n log4j.appender.A2=org.apache.log4j.RollingFileAppender log4j.appender.A2.File=${sntweb.root}/logs/c3p0.log log4j.appender.A2.MaxFileSize=500KB log4j.appender.A2.MaxBackupIndex=1 #log4j.appender.A2.layout=org.apache.log4j.HTMLLayout log4j.appender.A2.layout=org.apache.log4j.SimpleLayout

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/145187.html原文链接:https://javaforall.cn

0 人点赞