Skip to content

[feat] make logger in Rails include AS::LoggerSilence #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2025

Conversation

kares
Copy link
Member

@kares kares commented Jul 22, 2025

relevant changes in src/main/ruby/jruby/rack/rails/railtie.rb

the rest is getting stubs from Rails to be able to test this wout actual Rails

an alternative proposal to: #270

@kares kares added this to the 1.3.0 milestone Jul 22, 2025
@kares kares requested a review from chadlwilson July 25, 2025 08:09
@chadlwilson
Copy link
Contributor

I'm not sure I have the Rails logging expertise to seriously evaluate this but I'll have a go!

@kares kares merged commit 40ce36a into jruby:master Jul 25, 2025
37 of 38 checks passed
@kares
Copy link
Member Author

kares commented Jul 25, 2025

apologies, was testing out a (AI) work-flow locally and ended up with a premature merge... 🍼
I am fine to handle feedback post merge or even revert if there are concerns.

@kares
Copy link
Member Author

kares commented Jul 25, 2025

giving up on co-pilot here, asked it for a revert and re-open a got me with: #307 😒

ActiveSupport::TaggedLogging.new(logger) # returns a logger.clone
logger = ActiveSupport::TaggedLogging.new(logger) # returns a logger.clone
logger.singleton_class.instance_eval do
include ActiveSupport::LoggerSilence if defined?(ActiveSupport::LoggerSilence)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have just send(:include) here instead of eval-ing...

end

# Silences the logger for the duration of the block.
def silence(severity = Logger::ERROR)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should remove logger.silence from JRuby::Rack::Logger impl, which includes a dummy silence(level) { ... } implementation that does nothing (simply yields).

@kares kares deleted the integ-test-7.2 branch August 12, 2025 18:03
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.

Adding silence to logger with middleware works with puma but not with tomcat9
2 participants