如何抑制java.util.logging中的特定记录器?

时间:2019-02-23 18:54:31

标签: java logging javafx java.util.logging

我正在尝试获取有关JavaFX WebView发生的深层问题的可处理日志。

这种配置(毫不奇怪)为我提供了与我的问题无关的大量事件:

handlers= java.util.logging.ConsoleHandler
.level= FINEST
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.XMLFormatter

我特别收到了许多类似这样的事件,使我想找到的真正问题变得晦涩:

<record>
  <date>2019-02-23T15:05:45</date>
  <millis>1550946945429</millis>
  <sequence>12936</sequence>
  <logger>com.sun.javafx.webkit.prism.WCPathImpl</logger>
  <level>FINE</level>
  <class>com.sun.javafx.webkit.prism.WCPathImpl</class>
  <method>addLineTo</method>
  <thread>18</thread>
  <message>WCPathImpl(1,361).addLineTo(600,516)</message>
</record>

我试图通过将它添加到logging.properties中来禁止记录 com.sun.javafx.webkit.prism.WCPathImpl

com.sun.javafx.webkit.prism.WCPathImpl = OFF

那没有用。那个记录器仍然记录着我不需要解决这个问题的消息。

我正在尝试调试okta-aws-cli

如何隐藏java.util.logging中的特定记录器?

1 个答案:

答案 0 :(得分:1)

记录器名称不足。您需要指定要在记录器上更改的属性,在这种情况下为 level

代替此损坏的配置:

com.sun.javafx.webkit.prism.WCPathImpl = OFF

使用此配置专门引用记录器的level属性:

com.sun.javafx.webkit.prism.WCPathImpl.level = OFF