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

Use Honeybadger logging.level setting when logging to Rails log #375

Open
joshuap opened this issue Nov 5, 2020 · 4 comments
Open

Use Honeybadger logging.level setting when logging to Rails log #375

joshuap opened this issue Nov 5, 2020 · 4 comments

Comments

@joshuap
Copy link
Member

joshuap commented Nov 5, 2020

See #296 for additional context. Currently, the logging.level setting only works when logging.path (or a custom logger) is also configured. It would be nice if logging.level also applied to the default Rails logger, but only for Honeybadger. I think that people expect logging.level to work for Honeybadger logs regardless of where the output is being sent.

@KonnorRogers
Copy link
Collaborator

Perhaps an internal check before calling the logging methods?

For example:

if config.logging_level <= Logging::INFO
   logger.info(sprintf('Initializing Honeybadger Error Tracker for Ruby. Ship it! version=%s framework=%s', Honeybadger::VERSION, detected_framework))
end

Something like that for an internal check before calling the logger? The helpers in the "Logging" module would also have to be updated to have the log_level check I imagine.

@joshuap
Copy link
Member Author

joshuap commented Nov 22, 2022

@KonnorRogers yeah, I was thinking that we could probably add the suppression to the logging module so that it would just skip sending the log to the logger if our internal level is lower. We have a complicated logging setup. 😂

@subzero10
Copy link
Member

Perhaps an internal check before calling the logging methods?

For example:

if config.logging_level <= Logging::INFO
   logger.info(sprintf('Initializing Honeybadger Error Tracker for Ruby. Ship it! version=%s framework=%s', Honeybadger::VERSION, detected_framework))
end

Isn't this an anti-pattern though? I mean the whole point for calling a specific logging level method (logger.info, logger.error, etc.) is so that we let the logger decide if and where to send that log. Note: I don't know how logging is implemented in the Ruby client.

@joshuap
Copy link
Member Author

joshuap commented Dec 5, 2022

Perhaps an internal check before calling the logging methods?
For example:

if config.logging_level <= Logging::INFO
   logger.info(sprintf('Initializing Honeybadger Error Tracker for Ruby. Ship it! version=%s framework=%s', Honeybadger::VERSION, detected_framework))
end

Isn't this an anti-pattern though? I mean the whole point for calling a specific logging level method (logger.info, logger.error, etc.) is so that we let the logger decide if and where to send that log. Note: I don't know how logging is implemented in the Ruby client.

We share the Rails logger by default, but you can also configure a separate Honeybadger-specific logger. I think the best way to think about it is that our configured log level takes precedence, but only for our logs (when logging to the default Rails logger).

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

No branches or pull requests

3 participants