One, MAVEN relies on
<!--log File Management Pack -<!--Log Start -<Dependency> <groupId>org.apache.logging.log4j</groupId> <Artifactid>Log4j-api</Artifactid> <version>2.0</version> <Scope>Compile</Scope></Dependency><Dependency> <groupId>org.apache.logging.log4j</groupId> <Artifactid>Log4j-core</Artifactid> <version>2.0</version> <Scope>Compile</Scope></Dependency><!--LOG4JDBC Monitoring the JDBC layer -<Dependency> <groupId>Org.bgee.log4jdbc-log4j2</groupId> <Artifactid>log4jdbc-log4j2-jdbc4.1</Artifactid> <version>1.16</version></Dependency><!--SLF4J related APIs -<Dependency> <groupId>Org.slf4j</groupId> <Artifactid>Slf4j-api</Artifactid> <version>1.7.5</version></Dependency><!--an implementation package for the SLF4J -<Dependency> <groupId>Org.slf4j</groupId> <Artifactid>Slf4j-simple</Artifactid> <version>1.7.5</version></Dependency><!--Log End -
Second, the relevant configuration file
Log4jdbc.log4j2.properties
Log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.slf4jspylogdelegator
JDBC Driver and URL revision changed to
db.driverclassname=net.sf.log4jdbc.sql.jdbcapi.DriverSpydb.url=jdbc:log4jdbc:mysql:// Localhost:3306/wechat_talk?useunicOde=true&characterencoding=utf-8
LOG4J-related configuration XML or properties
Using LOG4JDBC-LOG4J2 to print MyBatis SQL statements