简体   繁体   English

Hibernate log4j无法识别log4j.properties

[英]Hibernate log4j not recognizing log4j.properties

I have a hibernate standard java application (not a webapp). 我有一个休眠的标准Java应用程序(不是webapp)。 Logging already works by default. 默认情况下,日志记录已经可以使用。 I would like to see the parameters passed in the sql queries. 我想查看在sql查询中传递的参数。 I have researched that in order to that I need to enable logging. 我已经对此进行了研究,以便启用日志记录。 It seems as if hibernate uses slf4j. 休眠状态似乎使用slf4j。 I have downloaded that jar and its accompanying slf4j-log4j jar. 我已经下载了该jar及其随附的slf4j-log4j jar。 I have added these jars to the classpath. 我已经将这些罐子添加到类路径中。 I have also added a log4j.properties to the root of the eclipse project. 我还向eclipse项目的根目录添加了log4j.properties。

I can't seem to have the project recognize that it needs to use slf4j and its properties file. 我似乎无法让该项目认识到它需要使用slf4j及其属性文件。

Do I need to add a reference in my hibernate.cfg.xml? 我是否需要在hibernate.cfg.xml中添加引用?

Make sure you have the property hibernate.show_sql set to true . 确保将属性hibernate.show_sql设置为true

format_sql set to true will make the SQL be formatted a bit more pretty. format_sql设置为true将使SQL的格式更加美观。

You may also need to log on TRACE level. 您可能还需要登录TRACE级别。

For more details have a look here or here . 有关更多详细信息,请在此处此处查看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM