Skip to content

Sentry logging doesn't respect log_level severity set in Rails #2696

@nbelzer

Description

@nbelzer

Problem Statement

We recently enabled the new Sentry logger (using config.enable_logs = true and the :logger patch) for our Rails application. We noticed that all logs are being forwarded to Sentry, regardless of the severity. We'd love to use this feature but are not interested in forwarding the massive amount of debug and info logs.

With some digging, I noticed that the patch introduced by the Sentry gem intercepts the calls to the logger and simply forwards all logs without respect for the log level. Is there any interest in adding logic to respect the log_level configured? I would be happy dive into the code.

Solution Brainstorm

By default Rails exposes a configuration option (log_level) that sets the minimum severity on the Rails.logger which is created by default. I suggest that when the gem is used within a Rails application we respect this configuration.

Metadata

Metadata

Assignees

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions