简体   繁体   English

需要解决Tomcat尝试记录事件后记录事件的Tomcat Webapp错误

[英]Need solution to webapp errors from Tomcat trying to log events after logger has been disposed

Enviroment: JSF 2.0, RichFaces 3.3.3, Facelets 1.1.15B1, Spring Framework 3.x, WebFlow 2.1, MyBatis 3.0.1, Oracle 10/11 g backend, SLF4j into Log4j. 环境:JSF 2.0,RichFaces 3.3.3,Facelets 1.1.15B1,Spring Framework 3.x,WebFlow 2.1,MyBatis 3.0.1,Oracle 10/11 g后端,从SLF4j到Log4j。 Well thats probably TMI since my issue is only a logging problem but better to be too thorough than not. 多数民众赞成在TMI上,因为我的问题只是一个日志记录问题,但总比不彻底要好。

Anyways... I just setup SLF4j & log4j so now all of the internal facelets log msgs are being dumped into log4j & I can actually see them. 无论如何...我只是设置了SLF4j和log4j,所以现在所有内部facelets日志消息都被转储到log4j中,我实际上可以看到它们。 In addition I setup Tomcat to also dump to log4j instead of it's custom version of JULI. 另外,我将Tomcat设置为也转储到log4j,而不是JULI的自定义版本。 Upon doing this everything appeared to be working great.... until i shut down the app. 完成此操作后,一切似乎都运转良好。...直到我关闭该应用程序。

Midway through the shutdown process my app started barfing up errors left 'n right because (which makes sense) Tomcat is trying to grab a logger instance AFTER spring has already cleaned up the logger bean. 在关闭过程的中途,我的应用开始从左向右推销错误,因为(这很有意义)因为Tomcat在春季已经清理了记录器bean之后试图获取一个记录器实例。

Anyone familiar with this? 有人熟悉吗? I imagine it must be a common problem for anyone who has Tomcat using the non-standard logging mechanism. 我想对于拥有使用非标准日志记录机制的Tomcat的任何人来说,这肯定是一个常见问题。 What is the best way around this? 最好的办法是什么?

I thought maybe if I just raised the log level then Tomcat wouldn't even try to log msgs because of the level req.s but the problem occurs when tomcat is trying to retrieve a logger instance so that didn't work. 我以为也许如果我只是提高了日志级别,那么由于req.s级别,Tomcat甚至都不会尝试记录msgs,但是当tomcat试图检索记录器实例时,问题就出现了,所以它不起作用。

I would move the Logger higher in the food chain. 我会将Logger移到食物链的更高位置。

I personally never configured log4j with spring relying on its own configuration mechanism (and hunting for where the heck it finds the properties file it is using in the process). 我个人从来没有依靠spring自己的配置机制来配置log4j(并寻找它在过程中使用的属性文件所在的位置)。

If you can you can opt to completely remove log4j from your war and rely on the log4j in the common tomcat library classpath. 如果可以的话,您可以选择完全从战争中删除log4j,并依靠通用tomcat库类路径中的log4j。 Then of course you are at the mercy of the tomcat configuration and you cannot access the log from inside your app, but it is always there during the complete lifecycle of your app. 然后,您当然要受tomcat配置的约束,您无法从应用程序内部访问日志,但是在应用程序的整个生命周期中,日志始终存在。

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

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