问题
I have a web application which is built using Struts2 (2.3.15.3) for MVC deployed on Oracle Weblogic 12c. The web app is working perfectly fine as is, just that when it is deployed in Weblogic, It prints some some extra info messages from struts code on the Weblogic std IO which is not required.
I have tried configuring the Weblogic logging servives by tweaking minimum severity to log value and changing the logging implementation to log4j from default JDK but that didn't help either.
It keeps printing these info messages from struts to the std output. I think the last thing I would want to do is play with LogFilterMBean
and write a custom log filter. Any suggestion around these? 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
回答1:
You can use xwork.loggerFactory
system property to specify a custom logger factory to use with the Struts2 framework. By default it chooses commons logging or slf4j in the order they are presented. How to write a logger factory you can find here.
For commons logging with log4j you can configure log4j
configuration file, properties for example
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
What appenders you use in my case is Console
, but you can change this. The server should react on this immediately by suppressing INFO
level.
来源:https://stackoverflow.com/questions/21399433/extra-info-messages-from-struts-appearing-during-weblogic-12c-startup