| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
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:
Sorry, something went wrong.
|
|
||
| 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>
|
I don't recall why we made this implementation choice at the time but we should look into it before merging this. |
Sorry, something went wrong.
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
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
BaseConfigurationService is the only class in operator-framework-core / operator-framework main sources that creates its SLF4J logger from a hard-coded string rather than from getClass() / 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 / %c pattern 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 BaseConfigurationService with the rest of the codebase by deriving the logger name from the class:
The public getLoggerName() method is preserved and now returns logger.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():
If 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