logback使用c3p0连接池没有写配置文件会报警告处理方法

logback使用c3p0连接池没有写配置文件会报警告处理方法_第1张图片
com.mchange.v2.cfg.DelayedLogItem [ level -> FINE, text -> “The configuration file for resource identifier ‘/mchange-commons.properties’ could not be found. Skipping.”, exception -> null]
com.mchange.v2.cfg.DelayedLogItem [ level -> FINE, text -> “The configuration file for resource identifier ‘/mchange-log.properties’ could not be found. Skipping.”, exception -> null]
com.mchange.v2.cfg.DelayedLogItem [ level -> FINE, text -> “The configuration file for resource identifier ‘/c3p0.properties’ could not be found. Skipping.”, exception -> null]

 怎么解决上面的警告
 方法一:         加入找不到报警的文件                          

在resources文件下加mchange-log.properties配置文件里面内容为

com.mchange.v2.log.MLog=com.mchange.v2.log.FallbackMLog 
com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL=OFF
方法二:		更换连接池

<configuration scan="true" scanPeriod="60 seconds" debug="false">
    <contextName>logbackcontextName>

    <property name="log.path" value="${user.dir}/logs"/>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <target>System.outtarget>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] -| %-5level %logger{40}-%msg%nPattern>
        encoder>
    appender>

    
    <appender name="ERROR_FILE_DAILY_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}//error.logfile>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] -| %-5level %logger{40} - %msg%nPattern>
        encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <maxHistory>30maxHistory>
            <fileNamePattern>${log.path}/error/%d.%i.logfileNamePattern>
            <maxFileSize>10MBmaxFileSize>
        rollingPolicy>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>errorlevel>
            <onMatch>ACCEPTonMatch>
            <onMismatch>DENYonMismatch>
        filter>
    appender>


    <appender name="DBAppender" class="ch.qos.logback.classic.db.DBAppender">
        
        <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
            <dataSource class="com.alibaba.druid.pool.DruidDataSource">
                <driverClassName>com.mysql.jdbc.DriverdriverClassName>
                <url>jdbc:mysql://47.101.xxx.xxx:3306/xy-pay-risk?autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&useSSL=falseurl>
                <username>rootusername>
                <password>Xykjxxxpassword>
                
                <name>logbackname>
                
                <initialSize>3initialSize>
                
                <minIdle>1minIdle>
                
                <maxIdle>10maxIdle>
                
                <maxActive>10maxActive>
                
                <maxWait>60000maxWait>
                
                <timeBetweenEvictionRunsMillis>60000timeBetweenEvictionRunsMillis>
                
                <removeAbandoned>trueremoveAbandoned>
                
                <removeAbandonedTimeout>180removeAbandonedTimeout>
            dataSource>
        connectionSource>

        




















        <filter class="com.xy.common.logback.LogLevelFilter">
            <greaterThan>infogreaterThan>
        filter>
    appender>

    <logger name="com.xy" level="warn"/>


    <logger name="com.xy.pay.risk.web.listener.SpringStartListener" level="info" additivity="false">
        <appender-ref ref="STDOUT"/>
    logger>

    <logger name="com.xy.pay.risk.web.listener.SpringStopListener" level="info" additivity="false">
        <appender-ref ref="STDOUT"/>
    logger>

    <root>
        <level value="error"/>
        <appender-ref ref="ERROR_FILE_DAILY_ROLLING"/>
        <appender-ref ref="DBAppender"/>
    root>

configuration>

你可能感兴趣的:(logback)