我有一个Web应用程序,它是使用Struts2(2.3.15.3)为部署在Oracle Weblogic 12c上的MVC构建的. Web应用程序工作正常,只是当它部署在Weblogic中时,它会从Weblogic std IO上的struts代码中打印一些额外的信息消息,这些消息不是必需的.
我已经尝试通过将最小严重性调整为日志值并将日志记录实现从默认JDK更改为log4j来配置Weblogic日志服务,但这也没有帮助.
它不断将这些信息消息从struts打印到std输出.我想我要做的最后一件事是使用LogFilterMBean并编写自定义日志过滤器.有关这些的任何建议吗? TIA
Jan 28, 2014 12:21:44 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
2014-01-28 12:21:48,352:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Parsing configuration file [struts-default.xml] [system]: XmlConfigurationProvider
2014-01-28 12:21:48,410:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Unable to locate configuration files of the name struts-plugin.xml, skipping [system]: XmlConfigurationProvider
2014-01-28 12:21:48,411:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Parsing configuration file [struts-plugin.xml] [system]: XmlConfigurationProvider
2014-01-28 12:21:48,465:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Parsing configuration file [struts.xml] [system]: XmlConfigurationProvider
2014-01-28 12:21:48,469:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.ObjectFactory) [system]: BeanSelectionProvider
2014-01-28 12:21:48,470:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.FileManagerFactory) [system]: BeanSelectionProvider
2014-01-28 12:21:48,470:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter) [system]: BeanSelectionProvider
2014-01-28 12:21:48,471:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.CollectionConverter) [system]: BeanSelectionProvider
2014-01-28 12:21:48,471:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.ArrayConverter) [system]: BeanSelectionProvider
2014-01-28 12:21:48,471:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.DateConverter) [system]: BeanSelectionProvider
2014-01-28 12:21:48,472:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.NumberConverter) [system]: BeanSelectionProvider
2014-01-28 12:21:48,472:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.StringConverter) [system]: BeanSelectionProvider
2014-01-28 12:21:48,472:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor) [system]: BeanSelectionProvider
2014-01-28 12:21:48,472:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionFileProcessor) [system]: BeanSelectionProvider
2014-01-28 12:21:48,473:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor) [system]: BeanSelectionProvider
2014-01-28 12:21:48,473:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.TypeConverterCreator) [system]: BeanSelectionProvider
2014-01-28 12:21:48,473:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.TypeConverterHolder) [system]: BeanSelectionProvider
2014-01-28 12:21:48,473:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider) [system]: BeanSelectionProvider
2014-01-28 12:21:48,473:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.LocaleProvider) [system]: BeanSelectionProvider
2014-01-28 12:21:48,473:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory) [system]: BeanSelectionProvider
2014-01-28 12:21:48,474:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer) [system]: BeanSelectionProvider
2014-01-28 12:21:48,474:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper) [system]: BeanSelectionProvider
2014-01-28 12:21:48,474:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest) [system]: BeanSelectionProvider
2014-01-28 12:21:48,474:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (org.apache.struts2.views.freemarker.FreemarkerManager) [system]: BeanSelectionProvider
2014-01-28 12:21:48,474:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (org.apache.struts2.views.velocity.VelocityManager) [system]: BeanSelectionProvider
2014-01-28 12:21:48,474:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (org.apache.struts2.components.UrlRenderer) [system]: BeanSelectionProvider
2014-01-28 12:21:48,474:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager) [system]: BeanSelectionProvider
2014-01-28 12:21:48,475:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory) [system]: BeanSelectionProvider
2014-01-28 12:21:48,475:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionProvider) [system]: BeanSelectionProvider
2014-01-28 12:21:48,475:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionContextFactory) [system]: BeanSelectionProvider
2014-01-28 12:21:48,475:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher) [system]: BeanSelectionProvider
2014-01-28 12:21:48,475:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader) [system]: BeanSelectionProvider
2014-01-28 12:21:48,475:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager) [system]: BeanSelectionProvider
2014-01-28 12:21:48,476:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper) [system]: BeanSelectionProvider
2014-01-28 12:21:48,476:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': Choosing bean (struts) for (com.opensymphony.xwork2.util.TextParser) [system]: BeanSelectionProvider
2014-01-28 12:21:48,690:INFO :[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)': WebLogic server detected. Enabling Struts parameter
解决方法:
您可以使用xwork.loggerFactory系统属性指定要与Struts2框架一起使用的自定义记录器工厂.默认情况下,它按照它们的显示顺序选择公共日志记录或slf4j.如何写一个记录器工厂,你可以找到here.
对于使用log4j进行日志记录的公共域,您可以配置log4j配置文件,例如属性
log4j.logger.org.apache=ERROR,Console
log4j.logger.com.opensymphony.xwork2=ERROR,Console
log4j.logger.com.opensymphony.xwork2.interceptor=ERROR
log4j.logger.com.opensymphony.xwork2.ognl=ERROR
log4j.logger.freemarker=ERROR,Console
你在我的案例中使用的是什么appender,但是你可以改变它.服务器应该通过抑制INFO级别立即做出反应.