Log4jdbc数据库访问日志框架使用(2)

public class Demo {
    private static Logger log = LoggerFactory.getLogger(Demo.class);
 
 
    public static void main(String[] args) throws SQLException {
        log.info("开始");
        Connection conn = DBUtils.getConnection();
        conn.createStatement().execute("select count(*) from xbm_region");
        JdbcUtils.executeQuery("select count(*) from xbm_region where id=?", "xxx");
        log.info("完成");
    }
}

使用Log4jdbc-log4j2监听MyBatis中运行的SQL和Connection 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/957753debec3b470d7692c07303fc2b7.html