(1)使用日志来实现SQL语句的输出。添加log4j的jar包:
(2)log4j文件的配置:
log4j.rootLogger=DEBUG,Console log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n log4j.logger.org.apache=INFO
(3)测试:
时间: 2024-11-02 08:42:50