}
return db;
}
}
Log4j数据库连接池的配置如下:
log4j.appender.JDBC=common.log.JDBCPoolAppender
log4j.appender.JDBC.sqlname=log
log4j.appender.JDBC.layout=org.apache.log4j.PatternLayout
log4j.appender.JDBC.sql=INSERT INTO LOGGING (log_date, log_level,
location, message) VALUES ('%d{ISO8601}', '%-5p', '%C,%L', '%m')
poolman.xml配置如下:
〈?xml version="1.0" encoding="UTF-8"?>
〈poolman>
〈management-mode>local〈/management-mode>
〈datasource>
〈dbname>log〈/dbname>
〈jndiName>log〈/jndiName>
〈driver>com.mysql.jdbc.Driver〈/driver>
〈url>jdbc:mysql://localhost:3306/test〈/url>
〈username>use〈/username>
〈password>password〈/password>
〈minimumSize>0〈/minimumSize>
〈maximumSize>10〈/maximumSize>
〈logFile>logs/mysql.log〈/logFile>
〈/datasource>
文章来源于领测软件测试网 https://www.ltesting.net/