- Notifications
You must be signed in to change notification settings - Fork 27
Refactor: logging improvements #47
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
connected? is an alias to open? (which we already have)
it's confusing to have to check what they mean these map cleanly for the ConnectionFactory property names
to the LS plugin logger
which will log Java traces on unexpected errors
* master: CI: keep re-using base docker-compose.yml (logstash-plugins#48)
... sample recovery (debug) log (also notice the
|
otherwise plugin.logger ignored error(e) calls
# | ||
# NOTE: effectively redirects MarchHare's default std-out logging to LS | ||
# (MARCH_HARE_LOG_LEVEL=debug no longer has an effect) | ||
connection.instance_variable_set(:@logger, LoggerAdapter.new(logger)) |
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.
we do not pass :logger => logger
to MarchHare
directly to avoid info logging a (less-relevant) message.
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.
LGTM
The only concern is that MarchHare logs goes under the logstash.inputs.rabbitmq
logger and this could potentially confuse the user, like in:
[2021-06-03T15:20:08,118][DEBUG][logstash.inputs.rabbitmq ][main][e78725282315e2c8afc972c397af7c336f135c4040a5c8ef1e74617e63d75b55] session: instantiating a new connection using a set of addresses: localhost:5672
But now we can have that log the before got lost.
Why is this important?
Currently the plugin does not gather logs from the underlying RabbitMQ library in LS' log.
Some debug logging by the frontend (
MarchHare
) could be accessed (w an env property) but ends up on STDERR.This PR integrates the underlying logging to be part of LS' logging mechanism
The first change is to redirect
MachHare
's logging to use theplugin.logger
. This is useful for debug level logging, and respects the logging level set on the plugin.Second logging improvement is to disable MarchHare's logging 'improvement' and simply use the RabbitMQ's
ForgivingExceptionHandler
to log exceptions, these are redirected (using SLF4J bridge) to LS logs and for unexpected errors include Java traces.Finally, we slightly normalize the logging format on Ruby errors (till a proper logging support is provided by LS).
There's a few minor refactorings (HINT: we run integration specs), old option names such as
:timeout
caused confusion in mapping the setting to the underlying RMQ ConnectionFactory property.