← Back to Issue

Allow ActiveSupport::ProxyLogger to ignore messages by pattern

From uloza+hey@proton.me · original ↗ · unsubscribe

Useful to silence noisy logs from gems that your application may not care about, without needing to change the log level and losing other useful logs.


Allow ActiveSupport::ProxyLogger to ignore messages by pattern by federico-carrocera · Pull Request #58328 · rails/rails · GitHub

Skip to content

Sign in

Appearance settings

Search/

Sign in

Sign up

Appearance settings

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

Uh oh!

There was an error while loading. Please reload this page.

rails / rails Public

Additional navigation options

Allow ActiveSupport::ProxyLogger to ignore messages by pattern - #58328

#58328

Merged

byroot merged 1 commit into

rails:mainrails/rails:mainfrom

federico-carrocera:fede/proxy-logger-ignore-patternsfederico-carrocera/rails:fede/proxy-logger-ignore-patternsCopy head branch name to clipboard

Aug 10, 2026

ConversationCommits1 (1)ChecksFiles changed

Merged

##

Allow ActiveSupport::ProxyLogger to ignore messages by pattern#58328

byroot merged 1 commit into

rails:mainrails/rails:mainfrom

federico-carrocera:fede/proxy-logger-ignore-patternsfederico-carrocera/rails:fede/proxy-logger-ignore-patternsCopy head branch name to clipboard

Conversation

@federico-carrocera

###

@federico-carrocerafederico-carrocera commented Jul 31, 2026

Copy link

Copy Markdown

Contributor

ProxyLogger can only filter by severity, so silencing one noisy message from a gem means raising the level and losing every message below it.

SomeLibrary.logger = ActiveSupport::ProxyLogger.new(Rails.logger).ignore(/Noisy/)

Regexps are matched against the message, strings are matched literally. Patterns are compiled into a single Regexp.union at registration time, and matching only happens after the severity check, so proxies without patterns are unaffected.

add now takes Logger#add’s explicit signature rather than forwarding ..., because the message has to be resolved before it can be matched.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions @github-actions github-actions Bot added the activesupport label Jul 31, 2026

@federico-carrocera@byroot

[Allow ActiveSupport::ProxyLogger to ignore messages by pattern](/rails/rails/pull/58328/commits/299defb0c79aff183da78196aa65e3d05c92d331 "Allow ActiveSupport::ProxyLogger to ignore messages by pattern ProxyLogger can only filter by severity, so silencing one noisy message from a gem means raising the level and losing every message below it. SomeLibrary.logger = ActiveSupport::ProxyLogger.new(Rails.logger) .ignore(/Noisy/) Regexps are matched against the message, strings are matched literally. Patterns are compiled into a single Regexp.union at registration time, and matching only happens after the severity check, so proxies without patterns are unaffected. add now takes Logger#add's explicit signature rather than forwarding `...`, because the message has to be resolved before it can be matched.") …

[299defb](/rails/rails/pull/58328/commits/299defb0c79aff183da78196aa65e3d05c92d331)

ProxyLogger can only filter by severity, so silencing one noisy message from a gem means raising the level and losing every message below it.

SomeLibrary.logger = ActiveSupport::ProxyLogger.new(Rails.logger)
  .ignore(/Noisy/)

Regexps are matched against the message, strings are matched literally. Patterns are compiled into a single Regexp.union at registration time, and matching only happens after the severity check, so proxies without patterns are unaffected.

add now takes Logger#add’s explicit signature rather than forwarding `…`, because the message has to be resolved before it can be matched.

@byroot

byroot force-pushed the fede/proxy-logger-ignore-patterns branch from f0b28f6 to 299defb Compare August 10, 2026 06:41

Hide details View details

@byroot

byroot merged commit 46347d1 into rails:main Aug 10, 2026

3 of 5 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

### Reviewers

No reviews

Assignees

No one assigned

Labels

activesupport

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@federico-carrocera@byroot

Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

© 2026 GitHub, Inc.

You can’t perform that action at this time.

Highlights & notes

    Notes