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

is "active" observer turned off for non-debug? #178

Closed
jjb opened this issue Nov 24, 2021 · 5 comments
Closed

is "active" observer turned off for non-debug? #178

jjb opened this issue Nov 24, 2021 · 5 comments

Comments

@jjb
Copy link
Contributor

jjb commented Nov 24, 2021

thanks for this project!

my tests locally show that "active" event fires even when log level is set to info

i have this in an initializer Rack::Timeout::Logger.level=Logger::INFO

and am logging env['rack-timeout.info']['state'] for each request, and i see active being logged

i don't see anything in the code which would disable it in non-debug mode

i addition to fixing this, would be cool if this were also configurable so it could be turned off in debug mode

@schneems
Copy link
Member

schneems commented Jun 9, 2022

Going to be honest. I don't know much about observers. Is there something you would like to update or change via a PR? Either documenting the current state or changing it? Is this related to #146 ?

@wuputah
Copy link
Collaborator

wuputah commented Jun 9, 2022

I would not expect state changes to active to be logged at INFO.
https://github.com/zombocom/rack-timeout/blob/main/lib/rack/timeout/logging-observer.rb#L44-L45

I suspect the problem may be in the way the OP is setting the logging level, i.e. maybe the logging level is getting changed, reset, or lost after initialization. The docs suggest you create a new logger first, which should assure your logging level does not get inherited/reset by the default logger (i.e. Rails).
https://github.com/zombocom/rack-timeout/blob/main/doc/logging.md

However the docs do imply that Rack::Timeout::Logger.level = Logger::INFO would create a new logger which should be immune from this issue. That feature derives from this code:
https://github.com/zombocom/rack-timeout/blob/main/lib/rack/timeout/logger.rb#L13-L15

This can be a bit tricky to follow but I believe it does what is says. So, I can't find the bug, but that doesn't mean one doesn't exist.

@wuputah
Copy link
Collaborator

wuputah commented Jun 9, 2022

#104 seems possibly related.

@schneems
Copy link
Member

schneems commented Jun 9, 2022 via email

@wuputah
Copy link
Collaborator

wuputah commented May 15, 2024

closing as stale

@wuputah wuputah closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
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