Skip to content
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

Disable logging #203

Open
marek22k opened this issue Jul 7, 2023 · 4 comments
Open

Disable logging #203

marek22k opened this issue Jul 7, 2023 · 4 comments

Comments

@marek22k
Copy link

marek22k commented Jul 7, 2023

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
@GalenkoEugene
Copy link

GalenkoEugene commented Jul 10, 2023

yes, try to find more details here
https://github.com/zombocom/rack-timeout/blob/main/doc/logging.md

PS: Rack::Timeout::Logger.disable

@marek22k
Copy link
Author

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.

@GalenkoEugene
Copy link

try to filter by env[::Rack::Timeout::ENV_INFO_KEY].state inside Rack::Timeout.register_state_change_observer block

@panozzaj
Copy link

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. :) ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants