hibernate 采用 apach common logging 、并结合 log4j 进行日志输出和控制。前面的简单实例中,之所以要引入log4j.properties,就是对日志输出的配置。
完整的log4j.properties文件如下所示:
1.### direct log messages to stdout ###2.log4j.appender.stdout=org.apache.log4j.ConsoleAppender3.log4j.appender.stdout.Target=System.out4.log4j.appender.stdout.layout=org.apache.log4j.PatternLayout5.log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n6.7.### direct messages to file hibernate.log ###8.#log4j.appender.file=org.apache.log4j.FileAppender9.#log4j.appender.file.File=hibernate.log10.#log4j.appender.file.layout=org.apache.log4j.PatternLayout11.#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n12.13.### set log levels - for more verbose logging change 'info' to 'debug' ###14.15.log4j.rootLogger=warn, stdout16.17.#log4j.logger.org.hibernate=info18.log4j.logger.org.hibernate=debug19.20.### log HQL query parser activity21.#log4j.logger.org.hibernate.hql.ast.AST=debug22.23.### log just the SQL24.#log4j.logger.org.hibernate.SQL=debug25.26.### log JDBC bind parameters ###27.log4j.logger.org.hibernate.type=info 28.#log4j.logger.org.hibernate.type=debug29.30.### log schema export/update ###31.log4j.logger.org.hibernate.tool.hbm2ddl=debug32. 33.### log HQL parse trees34.#log4j.logger.org.hibernate.hql=debug 35.36.### log cache activity ###37.#log4j.logger.org.hibernate.cache=debug 38. 39.### log transaction activity40.#log4j.logger.org.hibernate.transaction=debug 41. 42.### log JDBC resource acquisition43.#log4j.logger.org.hibernate.jdbc=debug 44. 45.### enable the following line if you want to track down connection ###46.### leakages when using DriverManagerConnectionProvider ###47.#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索hibernate
, debug
, apache
, log
, hibernate配置
, logging
, log4j.properties
, yii2 log配置
, stdout
, J4L-QRCode
, Logger
, java_web_log4j
java_log4j配置
,以便于您获取更多的相关知识。