How to show debug logs using java.util.logging

82 Views Asked by At

I've been asked to replace log4j with java.util.logging but i have a problem in replacing the debug logs.

In log4j when you want to show logs only in debug mode you just have to write:

log.debug("msg");

I can't find the equivalent method in java.util.logging. Can someone help me?

I tried setting the different Levels of the log, but I didn't find any solution.

1

There are 1 best solutions below

0
Jorn On

JUL doesn't have DEBUG and TRACE levels, it has CONFIG, FINE, FINER and FINEST. You'll have to decide which ones to use.

You'll also have to replace ERROR with SEVERE.