해당 라이브러리를 사용하면 콘솔에 SQL문 결과를 보기 좋게 출력할 수 있다.
| 절차
<!-- log4jdbc -->
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4</artifactId>
<version>1.16</version>
</dependency>
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
log4jdbc.dump.sql.maxlinelength=0
<root level="error">
<appender-ref ref="STDOUT" />
</root>
<logger name="site" level="DEBUG"/>
<logger name="jdbc" level="OFF"/>
<logger name="jdbc.connection" level="OFF"/>
<logger name="jdbc.sqlonly" level="OFF"/>
<logger name="jdbc.sqltiming" level="DEBUG"/>
<logger name="jdbc.audit" level="OFF"/>
<logger name="jdbc.resultset" level="OFF"/>
<logger name="jdbc.resultsettable" level="OFF"/>
<entry key="db.sql">mysql</entry>
<!-- <entry key="db.driver">com.mysql.jdbc.Driver</entry>-->
<!-- <entry key="db.url">jdbc:mysql://127.0.0.1:3306/DB 이름?useUnicode=true&characterEncoding=utf8</entry>-->
<entry key="db.driver">net.sf.log4jdbc.sql.jdbcapi.DriverSpy</entry>
<entry key="db.url">jdbc:log4jdbc:mysql://127.0.0.1:3306/DB 이름?useUnicode=true&characterEncoding=utf8</entry>
| 결과