赞
踩
- # Logback: the reliable, generic, fast and flexible logging framework.
- # Copyright (C) 1999-2010, QOS.ch. All rights reserved.
- #
- # See http://logback.qos.ch/license.html for the applicable licensing
- # conditions.
-
- # This SQL script creates the required tables by ch.qos.logback.classic.db.DBAppender.
- #
- # It is intended for MySQL databases. It has been tested on MySQL 5.1.37
- # on Linux
-
- use tumorpredict;
-
- BEGIN;
- DROP TABLE IF EXISTS logging_event_property;
- DROP TABLE IF EXISTS logging_event_exception;
- DROP TABLE IF EXISTS logging_event;
- COMMIT;
-
-
- BEGIN;
- CREATE TABLE logging_event
- (
- timestmp BIGINT NOT NULL,
- formatted_message TEXT NOT NULL,
- logger_name VARCHAR(254) NOT NULL,
- level_string VARCHAR(254) NOT NULL,
- thread_name VARCHAR(254),
- reference_flag SMALLINT,
- arg0 VARCHAR(254),
- arg1 VARCHAR(254),
- arg2 VARCHAR(254),
- arg3 VARCHAR(254),
- caller_filename VARCHAR(254) NOT NULL,
- caller_class VARCHAR(254) NOT NULL,
- caller_method VARCHAR(254) NOT NULL,
- caller_line CHAR(4) NOT NULL,
- event_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY
- );
- COMMIT;
-
- BEGIN;
- CREATE TABLE logging_event_property
- (
- event_id BIGINT NOT NULL,
- mapped_key VARCHAR(254) NOT NULL,
- mapped_value TEXT,
- PRIMARY KEY(event_id, mapped_key),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
- );
- COMMIT;
-
- BEGIN;
- CREATE TABLE logging_event_exception
- (
- event_id BIGINT NOT NULL,
- i SMALLINT NOT NULL,
- trace_line VARCHAR(254) NOT NULL,
- PRIMARY KEY(event_id, i),
- FOREIGN KEY (event_id) REFERENCES logging_event(event_id)
- );
- COMMIT;
XML详细配置
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd">
- <configuration>
-
- <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>%-20(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{80} - %msg%n</pattern>
- </layout>
- </appender>
-
- <!--
- <property name="log.base" value="../logs/" /> <appender name="file"
- class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.base}.log</file> <rollingPolicy
- class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${log.base}.%d{yyyy-MM-dd}.log.zip</fileNamePattern> </rollingPolicy> <layout
- class="ch.qos.logback.classic.PatternLayout"> <pattern>%-20(%d{HH:mm:ss.SSS} [%thread]) %-5level %logger{80} -
- %msg%n</pattern> </layout> </appender>
- <appender name="db-classic-oracle" class="ch.qos.logback.classic.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
- <dataSource class="org.apache.commons.dbcp.BasicDataSource">
- <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
- <url>jdbc:oracle:thin:@192.168.3.250:1521:devdb</url>
- <user>logback</user>
- <password>logback</password>
- </dataSource>
- </connectionSource>
- </appender>
- <appender name="db-classic-mysql" class="ch.qos.logback.classic.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
- <driverClass>com.mysql.jdbc.Driver</driverClass>
- <url>jdbc:mysql://localhost:3306/logbackdb</url>
- <user>root</user>
- <password>qqqqqq</password>
- </connectionSource>
- </appender>
- <appender name="db-access" class="ch.qos.logback.access.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
- <driverClass>com.mysql.jdbc.Driver</driverClass>
- <url>jdbc:mysql://localhost:3306/logbackdb</url>
- <user>root</user>
- <password>qqqqqq</password>
- </connectionSource>
- <insertHeaders>true</insertHeaders>
- </appender>
- -->
- <appender name="db-classic-mysql-pool" class="ch.qos.logback.classic.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
- <dataSource class="org.apache.commons.dbcp.BasicDataSource">
- <driverClassName>com.mysql.jdbc.Driver</driverClassName>
- <url>jdbc:mysql://localhost:3306/logbackdb</url>
- <username>root</username>
- <password>qqqqqq</password>
- </dataSource>
- </connectionSource>
- </appender>
-
- <appender name="db-classic-oracle-pool" class="ch.qos.logback.classic.db.DBAppender">
- <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
- <dataSource class="org.apache.commons.dbcp.BasicDataSource">
- <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
- <url>jdbc:oracle:thin:@192.168.3.250:1521:devdb</url>
- <username>logback</username>
- <password>logback</password>
- </dataSource>
- </connectionSource>
- </appender>
-
- <root level="WARN">
- <appender-ref ref="stdout" />
- <appender-ref ref="db-classic-oracle-pool" />
- </root>
- </configuration>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。