Quick revision
The short answer
The odd format on stderr comes from JUL's own root ConsoleHandler, which is still active because the jul-to-slf4j bridge is not installed, or a library attached its own handler. The slowdown after installing the bridge happens because JUL decides first whether a call is enabled: if the JUL logger is at FINE, every call builds a LogRecord and sends it through the bridge, even when Logback then throws it away. The fix is to install the bridge properly and keep JUL's levels in step with Logback's, usually with Logback's LevelChangePropagator and resetJUL set to true.
What to remember
In this answer, we saw two separate problems with one root: JUL and Logback each keep their own view of logging. The odd stderr format comes from JUL's ConsoleHandler when the bridge is missing or a library adds its own handler, and the fix is the jul-to-slf4j bridge with JUL's root handlers removed. The slowdown comes from JUL enabling calls that Logback later drops, and the fix is LevelChangePropagator with resetJUL, or setting the JUL level directly, or with Log4j2, replacing JUL's LogManager so there is only one set of levels.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The odd format on stderr comes from JUL's own root ConsoleHandler, which is still active because the jul-to-slf4j bridge is not installed, or a library attached its own handler. The slowdown after installing the bridge happens because JUL decides first whether a call is enabled: if the JUL logger is at FINE, every call builds a LogRecord and sends it through the bridge, even when Logback then throws it away. The fix is to install the bridge properly and keep JUL's levels in step with Logback's, usually with Logback's LevelChangePropagator and resetJUL set to true.
Why this question is asked
This is a typical production puzzle where two small problems look unrelated: the logs from one library look different from everything else, and turning on detailed logging for that library makes the whole service slow. Interviewers like it because the answer shows whether we understand how a logging bridge works, not just which jar to add. In this answer, we will recap how JUL and SLF4J meet, explain why the library's lines bypass our format, follow a call through the bridge to see where the time goes, and then go through the fixes for Logback and for Log4j2.
1A Quick Recap of the Two Logging Worlds
Our Spring Boot service logs through SLF4J, the logging API, and Logback, the backend that formats and writes the lines. The library logs through java.util.logging (JUL), the JDK's built-in framework. JUL has its own loggers, its own levels (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST) and its own handlers. In a fresh JVM, JUL's root logger has one ConsoleHandler that writes to System.err in a two-line format.
A bridge connects the two worlds. jul-to-slf4j provides SLF4JBridgeHandler, a JUL Handler that turns each JUL LogRecord into an SLF4J call. Once it is installed on JUL's root logger, JUL records flow into Logback and come out in our normal format.
2Problem 1: Why the Library's Lines Appear in a Different Format
If the lines arrive on stderr looking like "Nov 05, 2026 10:15:02 AM com.vendor.Client connect" followed by "INFO: Connected", they are being written by JUL's ConsoleHandler, not by Logback. Spring Boot installs the bridge automatically during logging setup, but only when the class SLF4JBridgeHandler is on the classpath. The most common cause is that jul-to-slf4j is missing: someone excluded spring-boot-starter-logging, or the application builds its own dependency set without it.
A second cause is a library that adds its own handler. The bridge removes the handlers of the root logger only. If the library does Logger.getLogger("com.vendor").addHandler(new ConsoleHandler()), its records are printed by that handler and also bridged, so we see each message twice, once in each format.
With the jar present, Boot calls SLF4JBridgeHandler.removeHandlersForRootLogger() and SLF4JBridgeHandler.install() for us. For a library with its own handler, we remove it at startup or set useParentHandlers and handlers for that logger in a JUL configuration, so only the bridge remains.
3Problem 2: Where the Time Goes After the Bridge Is Installed
The level check happens in JUL first. When the library calls log.fine(...), the JUL logger compares FINE with its own effective level. Only if JUL says yes does the record go anywhere. Logback's level is checked much later, inside the bridge.
Now suppose someone enabled FINE for the library on the JUL side, for example with com.vendor.level = FINE in a logging.properties file, or the root JUL level was set to ALL, while Logback still has com.vendor at INFO. Every fine() call passes JUL's check. JUL builds a LogRecord, which captures the time, the thread and the parameters, and works out the caller's class and method by walking the stack if anything asks for them. The bridge then converts the record, may format the message, and asks SLF4J to log it at DEBUG. Logback says DEBUG is off for com.vendor and drops it. All of that work was for nothing, and a chatty library can make millions of these calls.
6 messages in order. Play them, or step through them one at a time.
The expensive part happens before the only check that matters.
The other way round causes a different symptom. If Logback is at DEBUG for com.vendor but JUL is still at INFO, the FINE records never leave JUL, and we wonder why our DEBUG setting does nothing. Both cases come from two sets of levels that are not in step.
4Fix: Keep JUL Levels in Step With LevelChangePropagator
Logback ships a context listener called LevelChangePropagator. Whenever a Logback logger's level is set or changed, it sets the level of the JUL logger with the same name, translating DEBUG to FINE, TRACE to FINEST and so on. Then JUL's own check matches Logback's decision, and a disabled fine() call returns at once, as cheap as a disabled call in our own code.
Recent Spring Boot versions register a propagator themselves when they set up Logback with the bridge, but a custom configuration, an old Boot version or a library that sets its JUL level in code can still leave the levels out of step, so check your version and verify with a quick test. Now, when we really want the library's detail, we change one place, logging.level.com.vendor=DEBUG in application properties, and the propagator opens JUL's gate as well. The cost is then the honest cost of writing those lines, plus a small bridging overhead per record.
5Other Fixes: Setting JUL Directly, or Using Log4j2's JUL Support
Without the propagator, we can set the JUL logger level ourselves at startup, for example Logger.getLogger("com.vendor").setLevel(Level.INFO), and keep a strong reference to that logger, because JUL holds loggers weakly and a logger that is garbage collected loses its level. This works but means maintaining levels in two places.
If the service uses Log4j2 instead of Logback, there is a better option. The log4j-jul module provides a replacement LogManager. Started with -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager, set on the command line before anything touches JUL, it makes every JUL logger a thin front for a Log4j logger, so there is only one set of levels and no handler in between.
The property must be set at JVM start. If it is set from code after JUL has initialised, the JDK has already created its own LogManager and the setting is ignored.
6Follow-up questions
Why must LevelChangePropagator be set with resetJUL?
The propagator only copies a level when Logback sets or changes it. JUL loggers may already have levels from earlier: a logging.properties file that set com.vendor.level = FINE or the root to ALL, or a library that called setLevel in code before Logback started. Those stale levels would stay and keep building records for nothing. With resetJUL set to true, the propagator first clears the levels of all existing JUL loggers, so from then on Logback's configuration is the only source of truth.
How can I confirm the slowdown is the bridge and not the disk?
A profiler or a few thread dumps under load will show many stacks inside java.util.logging.Logger.log and SLF4JBridgeHandler.publish while very few lines are written to the log. That combination, lots of logging work and little output, points to records being created and dropped.
Is the bridge free once the levels agree?
Disabled calls become nearly free. Enabled calls still pay for building a LogRecord and converting it, which is noticeably more than a native SLF4J call. For a library that logs heavily at a level we always want, that overhead is worth measuring, and the Log4j2 LogManager route avoids it.
7Conclusion
In this answer, we saw two separate problems with one root: JUL and Logback each keep their own view of logging. The odd stderr format comes from JUL's ConsoleHandler when the bridge is missing or a library adds its own handler, and the fix is the jul-to-slf4j bridge with JUL's root handlers removed. The slowdown comes from JUL enabling calls that Logback later drops, and the fix is LevelChangePropagator with resetJUL, or setting the JUL level directly, or with Log4j2, replacing JUL's LogManager so there is only one set of levels.
Open with
There are two issues here. The odd format on stderr is JUL's own root ConsoleHandler. Spring Boot only installs SLF4JBridgeHandler and removes those root handlers when jul-to-slf4j is on the classpath, so I would check that the jar is there, and also check whether the library added a handler to its own logger, because the bridge only clears the root.
Then, if they want more
The slowdown is about where the level check happens. JUL checks its own level first, so if the JUL logger for that library is at FINE, every fine call builds a LogRecord, goes through the bridge, and then Logback drops it because its level is still INFO. That is a lot of work for nothing.
The fix is to keep the two in step: in logback-spring.xml I add the LevelChangePropagator context listener with resetJUL true, so Logback's levels are copied to JUL and any stale JUL levels are cleared. Then I set the level in one place, logging.level in Boot, and a disabled fine call is cheap again.
Without Logback, I can set the JUL level directly and hold a reference to the logger, or with Log4j2 use the log4j-jul LogManager set at JVM start so JUL loggers are Log4j loggers.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "In a Spring Boot service, a library logs through java.util.logging and its messages...": https://scrivio-interview-library.netlify.app/java/java-logging/4ae8a4e5e9/