Skip to content

Commit

Permalink
Include logger silence from active support
Browse files Browse the repository at this point in the history
  • Loading branch information
jlahtinen committed Dec 3, 2024
1 parent 2287eaa commit d193db5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/main/ruby/jruby/rack/rails/rails_logger.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'active_support/logger_silence'

module JRuby
module Rack
class RailsLogger < JRuby::Rack::Logger
include ActiveSupport::LoggerSilence

def info(*args)
return unless info?

super(*args)
end
end
end
end
5 changes: 4 additions & 1 deletion src/main/ruby/jruby/rack/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

require 'rails/railtie'
require 'pathname'
require 'jruby/rack/rails/rails_logger'

module JRuby::Rack
class Railtie < ::Rails::Railtie
Expand Down Expand Up @@ -37,7 +38,9 @@ class Railtie < ::Rails::Railtie

initializer 'set_servlet_logger', :before => :initialize_logger do |app|
app.config.logger ||= begin
config = app.config; logger = JRuby::Rack.logger
config = app.config
logger = RailsLogger.new
JRuby::Rack.logger = logger
log_level = config.log_level || :info
logger.level = logger.class.const_get(log_level.to_s.upcase)
log_formatter = config.log_formatter if config.respond_to?(:log_formatter) # >= 4.0
Expand Down

0 comments on commit d193db5

Please sign in to comment.