Draft
Conversation
This was referenced Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🥞 Stacked PR
Use this link to review incremental changes.
Summary
Adds a
java.util.logging(JUL) backend for the logging abstraction introduced in PR #740. Users who cannot or prefer not to use SLF4J can switch to JUL with a single line before creating any SDK client.Why
SLF4J is the right default for most users, but some environments (BI tools, embedded runtimes, minimal deployments) either don't ship an SLF4J binding or make it difficult to configure one. In those cases, the JDK's built-in
java.util.loggingis the only logging framework guaranteed to be available.Without a JUL backend, users in these environments would get silent NOP logging (if SLF4J has no binding) or would have to shim their own adapter. Providing a first-party JUL backend that they can activate with
LoggerFactory.setDefault(JulLoggerFactory.INSTANCE)removes that friction.What changed
Interface changes
JulLoggerFactory— new public concreteLoggerFactorysubclass with a singletonINSTANCE. Activating JUL is one line:LoggerFactory.setDefault(JulLoggerFactory.INSTANCE).Behavioral changes
None. The default backend is still SLF4J. JUL is only used when explicitly opted into.
Internal changes
JulLogger— package-private class that delegates to ajava.util.logging.Logger. Key implementation details:{}placeholders are substituted following the same semantics as SLF4J'sMessageFormatter.arrayFormat— trailing Throwables are unconditionally extracted and attached to theLogRecord, escaped\{}is rendered as literal{}, array arguments useArrays.deepToString, and null format strings return null.log(Level, String, Object[])method that constructs aLogRecordand walks the stack to set the correct source class/method, since JUL's automatic caller inference would otherwise attribute every record toJulLogger.debug→FINE,info→INFO,warn→WARNING,error→SEVERE.LoggerFactoryJavadoc — updated the usage example to referenceJulLoggerFactory.LoggerFactoryTest— addedsetDefaultSwitchesToJulandgetLoggerByNameWorksWithJultests.How is this tested?
JulLoggerTest— 12 tests covering placeholder formatting, trailing Throwable extraction, null/empty args, and end-to-end level mapping through all log methods.LoggingParityTest— 8 tests that compareJulLogger.formatMessageandJulLogger.extractThrowabledirectly againstorg.slf4j.helpers.MessageFormatter.arrayFormatfor the same inputs, covering: single Throwable arg, trailing Throwable beyond placeholders, no-placeholder Throwable, non-Throwable args, multi-arg with Throwable, array rendering, escaped placeholders, and null format strings.LoggerFactoryTest— 2 additional tests for JUL factory switching viasetDefault.