-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Add support for configuring logger groups via loggers endpoint #17515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I had a quick look at this enhancement a while back and was wondering if we couldn't use the existing loggers
endpoint for that. As you went the route of a dedicated endpoint, I'd love to hear your thoughts.
I've also added a few questions/suggestions.
|
||
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnAvailableEndpoint(endpoint = LoggerGroupsEndpoint.class) | ||
public class LoggersGroupEndpointAutoConfiguration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without looking at the concrete details, I would have updated the existing LoggersEndpoint
to handle both logger names and groups. While we're at the mercy of having a group having the same name as a logger, I wonder if handling them in a single place wouldn't be easier.
} | ||
|
||
@Test | ||
void runWithNoLoggerGroupsShouldNotHaveEndpointBean() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not entirely sure I get the rationale of this. IMO, If we go down the route of having a dedicated endpoint, I don't think it should 404 depending of the fact that at least a group is defined or not.
* @author HaiTao Zhang | ||
* @since 2.2.0 | ||
*/ | ||
public class LoggerGroups { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered updating LoggingSystem
rather than registering another singleton in the context? Given that became a feature handled there, perhaps we should expose it rather than having to lookup another type.
@htztomic I missed the conversation of using a separate endpoint while I was on PTO, sorry about that. Please ignore that part of the review for now. |
33b0fda
to
c829a89
Compare
13dedf6
to
bbaf119
Compare
When we added support for logging groups we did so without making any, I think, changes to the logging systems. I wonder if we should strive to do the same here? Would it work if we pulled out a separate class, say |
Gah, that's exactly what @htztomic had and I suggested in my review to avoid registering yet another bean. |
IMO, registering another bean is preferable to adding another responsibility to |
See gh-17515 Co-authored-by: Phillip Webb <[email protected]>
This is a fix to GitHub issue #16680 . The LoggerGroupsEndpoint gives support for GET configurations of logger groups or a single logger group as well configuring the LogLevel of a specific logger group.