如何 用slf4j logback 把日志异步记录到数据库中
展开全部
<!-- 将日志存储到oracle数据库中 -->
<appender name="db-classic-oracle" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
<dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">
<driverClass>oracle.jdbc.driver.OracleDriver</driverClass>
<url>jdbc:oracle:thin:@localhost:1521:ZYD</url>
<user>scott</user>
<password>tiger</password>
<sqlDialect class="ch.qos.logback.core.db.dialect.OracleDialect" />
</dataSource>
</connectionSource>
<sqlDialect class="ch.qos.logback.core.db.dialect.OracleDialect" />
</appender>
<appender name="db-classic-oracle" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
<dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">
<driverClass>oracle.jdbc.driver.OracleDriver</driverClass>
<url>jdbc:oracle:thin:@localhost:1521:ZYD</url>
<user>scott</user>
<password>tiger</password>
<sqlDialect class="ch.qos.logback.core.db.dialect.OracleDialect" />
</dataSource>
</connectionSource>
<sqlDialect class="ch.qos.logback.core.db.dialect.OracleDialect" />
</appender>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询