fix: use class-based logger name in BaseConfigurationService.#3352
Merged
csviri merged 1 commit intoMay 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the logging configuration of BaseConfigurationService to use a class-based logger and aligns getLoggerName() with the logger instance.
Changes:
- Replace the string-named SLF4J logger with a class-based logger (
BaseConfigurationService.class). - Update
getLoggerName()to return the current logger’s name rather than a hardcoded constant.
|
|
||
| private static final String LOGGER_NAME = "Default ConfigurationService implementation"; | ||
| private static final Logger logger = LoggerFactory.getLogger(LOGGER_NAME); | ||
| private static final Logger logger = LoggerFactory.getLogger(BaseConfigurationService.class); |
| @SuppressWarnings("unused") | ||
| public String getLoggerName() { | ||
| return LOGGER_NAME; | ||
| return logger.getName(); |
Signed-off-by: Dennis-Mircea Ciupitu <dennis.mircea.ciupitu@gmail.com>
26ea5a3 to
bc448c6
Compare
xstefank
approved these changes
May 15, 2026
Collaborator
|
I don't recall why we made this implementation choice at the time but we should look into it before merging this. |
csviri
approved these changes
May 15, 2026
Collaborator
There was a problem hiding this comment.
I don't recall it either, but since it is quite old commit, probably some leftover that we did not notice yet. So from my side this can go in.
Thank you! @Dennis-Mircea
Collaborator
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.
Summary
BaseConfigurationServiceis the only class inoperator-framework-core/operator-frameworkmain sources that creates its SLF4J logger from a hard-coded string rather than fromgetClass()/Class.class:That produces log lines like:
…which looks like a status message rather than a logger name when consumed by downstream operators (observed via Apache Flink Kubernetes Operator) and breaks the common
%logger/%cpattern most logback / log4j configurations rely on for filtering and routing.The literal string has been in place since 2021 (introduced in
10998f18"feat: log when a configuration is not found or created automatically") and has been the only such case for the entire time, so this looks like a stray inconsistency rather than an intentional choice.This PR aligns
BaseConfigurationServicewith the rest of the codebase by deriving the logger name from the class:The public
getLoggerName()method is preserved and now returnslogger.getName(), so the API still works and stays consistent with whatever the logger is actually configured with.Behavior change to be aware of
This does change the logger name as it appears in log output and in the value returned by
BaseConfigurationService#getLoggerName():Default ConfigurationService implementationio.javaoperatorsdk.operator.api.config.BaseConfigurationServiceIf any consumer has logback / log4j filters, appenders, or log-routing rules keyed on the old literal string, those configurations will need to be updated to the FQCN (or a prefix match against
io.javaoperatorsdk.operator.api.config). Worth a brief mention in the release notes.Test plan
./mvnw -pl operator-framework-core -am compile- succeeds, no new warnings../mvnw -pl operator-framework-core -am test -Dtest=ConfigurationServiceOverriderTest- passes (2/2).