简体   繁体   English

避免外部框架J2EE的日志跟踪

[英]Avoid log trace of external framework J2EE

I have an J2EE application with Liferay using an external framework (DWR). 我有一个使用外部框架(DWR)的Liferay的J2EE应用程序。 That framework is tracing in the log a lot of useless info with "INFO" level. 该框架正在日志中跟踪许多“ INFO”级别的无用信息。

I have set the package of framework (uk.ltd.getahead.dwr) with "ERROR" level, however this is not working. 我已将框架(uk.ltd.getahead.dwr)的程序包设置为“错误”级别,但是此方法不起作用。

Liferay uses log4j. Liferay使用log4j。 I have searched about it and DWR uses log4j too. 我已经搜索过了,DWR也使用log4j。

Try to check if the jar of the framework contains it's own log configuration file, logback.xm or similar. 尝试检查框架的jar是否包含其自己的日志配置文件logback.xm或类似文件。 Then that file is the one controlling the output. 然后,该文件就是控制输出的文件。

Try adding a log4j.xml file to your web (portlet?) application and configure a file based appender in it, rather than the normal "console" appender. 尝试将log4j.xml文件添加到Web(portlet?)应用程序,并在其中配置基于文件的附加程序,而不是普通的“控制台”附加程序。

This should direct all logging generated by your application to a file and avoid the "catch all" console log. 这应将您的应用程序生成的所有日志记录定向到一个文件,并避免“全部捕获”控制台日志。

Your web application occupies a different class loader than the Liferay portal components and can therefore control it's own logging (assuming that you have log4j.jar within your own app in WEB-INF/lib). 您的Web应用程序与Liferay门户组件所占用的类加载器不同,因此可以控制它自己的日志记录(假设您在WEB-INF / lib中自己的应用程序中包含log4j.jar)。

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

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