Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 休眠log4j不识别log4j.properties_Java_Hibernate_Logging_Log4j_Slf4j - Fatal编程技术网

Java 休眠log4j不识别log4j.properties

Java 休眠log4j不识别log4j.properties,java,hibernate,logging,log4j,slf4j,Java,Hibernate,Logging,Log4j,Slf4j,我有一个hibernate标准java应用程序(不是webapp)。默认情况下,日志记录已起作用。我希望看到在sql查询中传递的参数。我已经对此进行了研究,为了实现这一点,我需要启用日志记录。似乎hibernate使用了slf4j。我已经下载了这个jar及其附带的slf4j-log4j jar。我已经将这些JAR添加到类路径中。我还向eclipse项目的根添加了log4j.properties 我似乎无法让项目认识到它需要使用slf4j及其属性文件 是否需要在hibernate.cfg.xml中

我有一个hibernate标准java应用程序(不是webapp)。默认情况下,日志记录已起作用。我希望看到在sql查询中传递的参数。我已经对此进行了研究,为了实现这一点,我需要启用日志记录。似乎hibernate使用了slf4j。我已经下载了这个jar及其附带的slf4j-log4j jar。我已经将这些JAR添加到类路径中。我还向eclipse项目的根添加了log4j.properties

我似乎无法让项目认识到它需要使用slf4j及其属性文件


是否需要在hibernate.cfg.xml中添加引用

确保将属性
hibernate.show\u sql
设置为
true

format\u sql
设置为true将使sql的格式更加美观

您可能还需要登录跟踪级别


有关更多详细信息,请查看或。

AFAIK我认为您不需要提及hibernate.cfg或web.xml中的引用。我运行了一个Spring mvc hibernate应用程序,并使用slf4j记录版本1.4.2。只需尝试更改可能会有所帮助的版本。您想看到类似的内容吗?[休眠:从“帐户”contact0\u中选择contact0\u帐户作为account0\u,contact0\u。cycle\u日期作为cycle2\u 0\u,contact0\u。letter\u代码作为letter3\u 0\u,contact0\u。状态作为status0\u]