Skip to content

Commit 2c6b6c9

Browse files
committed
[fix] Disable silence functionality quietly on Rails 5.0/5.2
1 parent 7e9bb85 commit 2c6b6c9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/ruby/jruby/rack/rails/rails_logger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module JRuby::Rack
44
class RailsLogger < JRuby::Rack::Logger
5-
include ActiveSupport::LoggerSilence
5+
include ActiveSupport::LoggerSilence if defined?(ActiveSupport::LoggerSilence)
66
end
77
end

src/spec/ruby/jruby/rack/integration_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,12 @@
185185
unwrap_logger = "logger = Rails.logger.broadcasts.first;"
186186
end
187187

188-
# sanity check logger-silence works:
189-
should_eval_as_eql_to "#{unwrap_logger} logger.silence { logger.warn('from-integration-spec') }", true
190-
191-
should_eval_as_eql_to "#{unwrap_logger} logger.real_logger.is_a?(org.jruby.rack.logging.ServletContextLogger)", true
188+
if Rails::VERSION::STRING >= '6.0'
189+
# sanity check logger-silence works:
190+
should_eval_as_not_nil "#{unwrap_logger} defined?(logger.silence)"
191+
should_eval_as_eql_to "#{unwrap_logger} logger.silence { logger.warn('from-integration-spec') }", true
192+
should_eval_as_eql_to "#{unwrap_logger} logger.real_logger.is_a?(org.jruby.rack.logging.ServletContextLogger)", true
193+
end
192194
end
193195

194196
it "sets up public_path" do

0 commit comments

Comments
 (0)