简体   繁体   English

Tomcat和logback.xml

[英]Tomcat and logback.xml

I am starting up a Seam + Hibernate + Logback project deployed to Tomcat 6 . 我正在启动一个部署到Tomcat 6Seam + Hibernate + Logback项目。 I use Eclipse as an IDE . 我使用Eclipse作为IDE Hibernate prints many debug statements, so I have put the level to ERROR , so I don't see them. Hibernate打印了很多调试语句,所以我把级别设置为ERROR ,所以我没有看到它们。

<logger name="org.hibernate">
    <level value="ERROR" />
</logger>

I don't paste my whole logback.xml , because the problem I have, is not connected with its contents. 我没有粘贴我的整个logback.xml ,因为我logback.xml的问题与其内容没有关联。

I have the following classpath problem - If I put the logback.xml in WEB-INF\\classes of my project, it is not found by the classloader and I see all debug statements. 我有以下类路径问题 - 如果我将logback.xml放在我的项目的WEB-INF\\classes中,类加载器找不到它,我看到所有的调试语句。 On the other hand, if I move the logback.xml to the lib directory of Tomcat , everything works perfect and the debug statements are not printed. 另一方面,如果我将logback.xml移动到Tomcatlib目录,一切都很完美,并且不会打印调试语句。

But I want to have my logback.xml inside my project, not in the root lib directory of Tomcat. 但我想在我的项目中使用我的logback.xml ,而不是在Tomcat的根lib目录中。

And here is my question - isn't the WEB-INF\\classes a correct place for logback.xml ? 这是我的问题 - 不是WEB-INF\\classeslogback.xml的正确位置吗? Why isn't it found? 为什么不找到它?

I have always known that the files under the WEB-INF\\classes directory of the project, are put to the classpath. 我一直都知道项目的WEB-INF\\classes目录下的文件被放到了classpath中。 Thank you for any ideas you have. 感谢您的任何想法。

All the best, Petar 一切顺利,Petar

It looks like your logback.jar is also under ${catalina.home}\\lib . 看起来你的logback.jar也在${catalina.home}\\lib

If you want to put your logback.xml to \\WEB-INF\\classes , the logback.jar should be only under \\WEB-INF\\lib . 如果要将logback.xml放到\\WEB-INF\\classes ,则logback.jar应该只在\\WEB-INF\\lib The ${catalina.home}\\lib\\logback.jar should be removed. 应删除${catalina.home}\\lib\\logback.jar

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

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