Disable logging
marek22k opened this issue · 4 comments
Hello,
is it possible to disable logging? I always get the following messages in the log:
source=rack-timeout id=dc7e9475-056f-467b-94f4-bbdd4e785e16 timeout=30000ms service=17ms state=completed at=info
source=rack-timeout id=dc7e9475-056f-467b-94f4-bbdd4e785e16 timeout=30000ms state=ready at=info
yes, try to find more details here
https://github.com/zombocom/rack-timeout/blob/main/doc/logging.md
PS: Rack::Timeout::Logger.disable
Mhh, this works only conditionally. I can disable logging and assign my own logger. But what does not work is to assign my logger and change the logging level.
Rack::Timeout::Logger.level = Logger::DEBUG
Rack::Timeout::Logger.logger = $Logger
still logs with level Info.
try to filter by env[::Rack::Timeout::ENV_INFO_KEY].state
inside Rack::Timeout.register_state_change_observer
block
I was looking for a way to make the logger only log when there was an exceptional case. I added:
Rack::Timeout::Logger.level = Logger::ERROR
in an initializer. Testing locally, this seems to cause only error-level (or higher) log messages to be printed.
@marek22k maybe you should flip the statements you listed, since the first one changes the log level of the rack-timeout
default logger, and the second changes the logger to your custom $Logger
(which uses whatever log level $Logger
was already set to.)
[Could be wrong, and not a maintainer of this project. :) ]