-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
The behaviour of cluster settings API for changing log levels #65208
Comments
Pinging @elastic/es-core-infra (Team:Core/Infra) |
cc @ywangd and @jasontedor |
and it is more unclear when you "clear" the loggers with
|
we discussed this on core infra sync on 18th Nov. However, this also has a downside that if a user overrides a logger which was not set by him earlier, he will not be aware that he is changing it and what was the previous level. If we were to stay with current behaviour of allowing to apply the level for the whole hierarchy we should consider to:
we did not reach conclusion and will continue discussion here |
I think that, given the users' expectations coming from log4j2 configuration, the behavior that less specific log level configs override more specific ones is counter intuitive. My leaning is to implement the log4j2 behavior that more specific configs override parent configs. If we desire to maintain the capability to affect all the logger in a hierarchy, I think we could employ the wildcard trick we use elsewhere, eg:
will iteratively descend in the hierarchy of more specific loggers and change their levels. If no loggers exist, this is a no-op.
This latter call, unlike the previous one, will be reflected in the |
Just wanted to add the original issue that sparked this discussion. During recent BugPool meeting, a case was reported about ActiveDirectory realm configuration. As a standard approach, trace logging was suggested, i.e.:
However, because the user had When working with customers through messages, it is challenging to configure the logging level with 100% confidence with this behaviour. We would need to first ask user to provide the content of |
there is some confusion about how configuring logging levels via
cluster settings
api works.as per doc we change logging level for a logger via
the current logging also trickle down the logging hierarchy and sets that level on all the loggers down the hierarchy. Meaning loggers
logger.org.elasticsearch.transport.X
andlogger.org.elasticsearch.transport.X.Y
will have a levelDEBUG
too.This is expected and works the same way as log4j configuration from a file.
However if you set a logger down the hierarchy earlier
"logger.org.elasticsearch.transport.X": "TRACE"
the subsequent call to set
"logger.org.elasticsearch.transport": "DEBUG"
willoverridde
"logger.org.elasticsearch.transport.X"
logger toDEBUG
that is different to what you would expect from log4j configuration,
-- but it make using the API easier. You don't have to remember which loggers down the hierarchy you have changed and allows you to "clear" them back
the
get /_cluster/settings
still showslogger.org.elasticsearch.transport.X" = trace
even thought you overriden it withlogger.org.elasticsearch.transport = debug
in order to really enforce
logger.org.elasticsearch.transport.X
to betrace
you have to trigger cluster state settings change. Meaning you have to change it to something else (like debug) and then switch it back to intendedtrace
value.I think we should either
or
get /_cluster/settings
is incorrectreproduce steps:
expect:
result with
also expect that
HttpTracer
starts logging itstrace
messagesHttpTracer
no longer logsthe result of
_cluster/settings
is not clearthe change was intentionally introduced #20463
The text was updated successfully, but these errors were encountered: