从Logger中过滤掉不需要的INFO消息 [英] Filter unwanted INFO-Messages from Logger
问题描述
我正在使用 java.util.logging
登录我的Java应用程序。我还使用 javax.xml.ws.Endpoint
来发布SOAP接口。
I'm using java.util.logging
to log in my Java application. I'm also using javax.xml.ws.Endpoint
to publish a SOAP-interface.
随着时间的推移,我添加了越来越多的异常,这些异常在启动时都会出现这样的日志条目:
Over the time I added more and more exceptions which all turn up at startup with a log-entry like this:
Jan 24, 2011 12:29:27 PM com.sun.xml.internal.ws.model.RuntimeModeler getExceptionBeanClass
INFO: Dynamically creating exception bean Class de.wi08e.myhome.frontend.jaxws.NotLoggedInBean
我尝试使用过滤器阻止它们,但我不是确定使用获取哪个类getLogger
:
I tried following filter to block them, but I'm not sure which class to get with getLogger
:
/* Filter ExceptionBeanClass logs */
Logger loggerInfo = Logger.getLogger("javax.xml.ws.Endpoint");
loggerInfo.setFilter(new Filter() {
@Override
public boolean isLoggable(LogRecord l) {
System.out.println(l.getMessage());
if (l.getMessage().startsWith("Dynamically creating exception bean Class"))
return false;
return true;
}
});
有谁知道如何找出哪个类创建此日志条目?有没有其他方法来过滤掉这些紧张的消息?
Does anyone know how to find out which class creates this log-entries? Is there another way to filter out this nerving messages?
编辑:我也试过 Logger.getLogger(com.sun.xml.internal。 ws.model.RuntimeModeler)
,但它仍然无效...
I also tried Logger.getLogger("com.sun.xml.internal.ws.model.RuntimeModeler")
, but it's still not working...
推荐答案
你应该能够使用以下标志运行java程序: -Djava.util.logging.config.file =< mylogging.properties>
其中mylogging.properties是一个文件使用以下内容而不是在代码中执行此操作。
You should be able to just run the java program with the following flag: -Djava.util.logging.config.file=<mylogging.properties>
where mylogging.properties is a file with the following contents instead of doing it in code.
javax.enterprise.resource.webservices.jaxws.server.level = WARN
来自 http://www.docjar.com/html/api/com/sun/xml/internal/ws/model/RuntimeModeler .java.html
186 private static final Logger logger =
187 Logger.getLogger(
188 com.sun.xml.internal.ws.util.Constants.LoggingDomain + ".server");
和来自常数
public static final java.lang.String LoggingDomain = "javax.enterprise.resource.webservices.jaxws";
这篇关于从Logger中过滤掉不需要的INFO消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!