logging connection pooling for org.apache.commons.dbcp.BasicDataSource with spring

前端 未结 2 1215
长发绾君心
长发绾君心 2021-02-13 05:37

I am trying to log connection pooling for org.apache.commons.dbcp.BasicDataSource using log4j

I am using spring framework for dao layer injection.

W

2条回答
  •  你的背包
    2021-02-13 06:02

    Its too late since the question was asked but this is how I fixed the issue:

    Specify the logger to the driver in JDBC URL

    new BasicDataSource().setUrl("jdbc:mysql://localhost/DBName?logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true");
    

提交回复
热议问题