如何将Hibernate生成的SQL语句打印到日志文件

2024-12-02 03:03:00
推荐回答(1个)
回答1:

log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=e:\\xxx.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=info, file

日志路径可以自己指定