Features

Logs (experimental)

Same as Rails.logger, but per request

If you're used to tail the logs, you'll love this feature. It's the same logs, but per request and easily accessible.

In a typical setup, you might have background job running while the frontend just made 3 requests. The logs are all entangled together, and it's hard to find what you're looking for.

This feature is experimental. It works but I'd like better filtering, better display and a better way to set it up. For now, this feature is not shown on the demo at the bottom of this page.

Screenshot of logs in the debugbar

Configuration

First, set up the minimum log level to be added to the debugbar panel.

1Debugbar.configure do |config|
2 config.min_log_level = ::Logger::Severity::WARN
3end

Second, you need to configure the logger manually. This is the part that I'm hoping to be able to do automcatically in the future.

1# config/environments/development.rb
2# You can reuse the logger you already have
3existing_logger = ActiveSupport::Logger.new("log/#{Rails.env}.log")
4# or existing_logger = ActiveSupport::Logger.new(STDOUT)
5 
6broadcast = ActiveSupport::BroadcastLogger.new(existing_logger)
7debugbar_logger = Debugbar::SimpleLogger.new(Debugbar.config.min_log_level)
8broadcast.broadcast_to(debugbar_logger)
9config.logger = broadcast