Description
Description
When running Rails console in non-development, Honeybadger outputs excessive plugin initialization logs that make the console nearly unusable. Even with debug: false
in honeybadger.yml, dozens of lines like these appear:
** [Honeybadger] skip plugin name=karafka reason=requirement level=0 pid=10 at="lib/honeybadger/plugin.rb:257:in 'Honeybadger::Plugin#load!'"
** [Honeybadger] skip plugin name=lambda reason=requirement level=0 pid=10 at="lib/honeybadger/plugin.rb:257:in 'Honeybadger::Plugin#load!'"
** [Honeybadger] skip plugin name=local_variables reason=requirement level=0 pid=10 at="lib/honeybadger/plugin.rb:257:in 'Honeybadger::Plugin#load!'"
Environment
- Honeybadger gem version: 5.27.1
- Rails version: 8.0.2
- Ruby version: 3.4.1
Steps to reproduce
- Add Honeybadger to a Rails app
- Set log_level to INFO in development
- Run
rails console
Workaround
I found that completely replacing the logger (rather than changing log levels) works:
# config/initializers/honeybadger.rb
if defined?(Rails::Console)
require "logger"
null_logger = Logger.new(File::NULL)
Honeybadger.configure do |config|
config.logger = null_logger
end
end
Is this the appropriate workaround? It would be helpful to note this in your documentation specifically for console environments, as it's not intuitive that replacing the logger is needed rather than configuring log levels.
Expected behavior
No or minimal initialization logs in the console.
Actual behavior
Dozens of plugin initialization logs appear, making the console difficult to use.
Attempted solutions
- Setting
debug: false
in honeybadger.yml doesn't help - Using ENV vars like
HONEYBADGER_INSIGHTS_ENABLED=false
doesn't help - Setting
HONEYBADGER_PLUGINS=[]
doesn't help
Related issues
This appears related to #375 "Use Honeybadger logging.level setting when logging to Rails log" which has been open since 2020.
(edit: changed "When running Rails console in development" to "When running Rails console in non-development")