Alain O'Dea
Alain O'Dea

Reputation: 21716

How do I suppress specific loggers in java.util.logging?

I'm trying to get processable logs of deep issues occurring with a JavaFX WebView.

This configuration (unsurprisingly) gives me masses of events unrelated to my problem:

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

I specifically get many events like this obscuring the real issue I am trying to find:

<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>

I tried to suppress logging com.sun.javafx.webkit.prism.WCPathImpl by adding this to logging.properties:

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

That didn't work. That logger still logs a firehose of messages I don't need to solve this problem.

I'm trying this to debug okta-aws-cli.

How do I suppress specific loggers in java.util.logging?

Upvotes: 1

Views: 589

Answers (1)

Alain O&#39;Dea
Alain O&#39;Dea

Reputation: 21716

The logger name isn't sufficient. You need to specify which property you are changing on the logger, in this case level.

Instead of this broken configuration:

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

Use this configuration specifically referencing the level property of the logger:

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

Upvotes: 1

Related Questions