Skip to content

Fix ArgumentError when Rails.logger is wrapped by SemanticLogger#8

Merged
kdonovan merged 1 commit into
mainfrom
KD/support-semantic-logger
Feb 23, 2026
Merged

Fix ArgumentError when Rails.logger is wrapped by SemanticLogger#8
kdonovan merged 1 commit into
mainfrom
KD/support-semantic-logger

Conversation

@kdonovan
Copy link
Copy Markdown
Contributor

When OS (or any app) wraps Rails.logger with SemanticLogger, logger.level returns a symbol (e.g. :info, :debug) instead of the standard Ruby Logger integer constants. The override-warning logic in DeclarativeInitialization::Internal#warn_override? was doing logger.level <= Logger::DEBUG, which raised ArgumentError: comparison of Symbol with 0 failed in production.

Change: Only compare logger.level to Logger::DEBUG when level is an integer. If the logger uses a non-integer level (e.g. SemanticLogger), skip the level check and do not warn—so behavior in Rails dev/test is unchanged, standard Logger behavior is unchanged, and SemanticLogger (and similar) no longer raise.

Bump to 0.2.1 with changelog entry.

@kdonovan kdonovan merged commit 865cc39 into main Feb 23, 2026
1 check passed
@kdonovan kdonovan deleted the KD/support-semantic-logger branch February 23, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant