logback.xml,logback-test.xml同时存在时,默认起作用的配置是logback-test.xml,发布到生产库时,不上传logback-test.xml,那么起作用的日志配置文件是logback.xml
把日志文件logback.xml的日志级别调整为debug
<root level="debug">
spring会输出内部的日志消息,如建立连接池,取得连接,释放连接等等 如下
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Creating new transaction with name [com.mycompany.project.service.XXXService.getYYY: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Acquired Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] for JDBC transaction
DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Setting JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] read-only
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Switching JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] to manual commit
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Initiating transaction commit
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Committing JDBC transaction on Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2]
DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Resetting read-only flag of JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2]
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Releasing JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] after transaction
DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
在root的日志级别高于debug时,强制要求输出debug级别的日志信息:
<logger name="com.ibatis.sqlmap.engine.cache.CacheModel" level="DEBUG" />
<logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG" />
<logger name="com.ibatis" level="DEBUG" />
<logger name="com.ibatis.common.util.StopWatch" level="DEBUG" />
<logger name="java.sql.Statement" level="INFO" />
<logger name="java.sql.ResultSet" level="INFO" />
<logger name="com.ibatis.sqlmap.engine.builder.xml.SqlMapParser" level="DEBUG" />
<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientImpl" level="DEBUG" />
<logger name="java.sql.PreparedStatement" level="DEBUG" />
<logger name="org.springframework.ui.freemarker" level="DEBUG" />
把日志文件logback.xml的日志级别调整为debug
<root level="debug">
spring会输出内部的日志消息,如建立连接池,取得连接,释放连接等等 如下
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Creating new transaction with name [com.mycompany.project.service.XXXService.getYYY: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Acquired Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] for JDBC transaction
DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Setting JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] read-only
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Switching JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] to manual commit
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Initiating transaction commit
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Committing JDBC transaction on Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2]
DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Resetting read-only flag of JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2]
DEBUG org.springframework.jdbc.datasource.DataSourceTransactionManager - Releasing JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@1d59cc2] after transaction
DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
在root的日志级别高于debug时,强制要求输出debug级别的日志信息:
<logger name="com.ibatis.sqlmap.engine.cache.CacheModel" level="DEBUG" />
<logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG" />
<logger name="com.ibatis" level="DEBUG" />
<logger name="com.ibatis.common.util.StopWatch" level="DEBUG" />
<logger name="java.sql.Statement" level="INFO" />
<logger name="java.sql.ResultSet" level="INFO" />
<logger name="com.ibatis.sqlmap.engine.builder.xml.SqlMapParser" level="DEBUG" />
<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientImpl" level="DEBUG" />
<logger name="java.sql.PreparedStatement" level="DEBUG" />
<logger name="org.springframework.ui.freemarker" level="DEBUG" />