Skip to content

Commit d193db5

Browse files
committed
Include logger silence from active support
1 parent 2287eaa commit d193db5

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require 'active_support/logger_silence'
2+
3+
module JRuby
4+
module Rack
5+
class RailsLogger < JRuby::Rack::Logger
6+
include ActiveSupport::LoggerSilence
7+
8+
def info(*args)
9+
return unless info?
10+
11+
super(*args)
12+
end
13+
end
14+
end
15+
end

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
require 'rails/railtie'
1010
require 'pathname'
11+
require 'jruby/rack/rails/rails_logger'
1112

1213
module JRuby::Rack
1314
class Railtie < ::Rails::Railtie
@@ -37,7 +38,9 @@ class Railtie < ::Rails::Railtie
3738

3839
initializer 'set_servlet_logger', :before => :initialize_logger do |app|
3940
app.config.logger ||= begin
40-
config = app.config; logger = JRuby::Rack.logger
41+
config = app.config
42+
logger = RailsLogger.new
43+
JRuby::Rack.logger = logger
4144
log_level = config.log_level || :info
4245
logger.level = logger.class.const_get(log_level.to_s.upcase)
4346
log_formatter = config.log_formatter if config.respond_to?(:log_formatter) # >= 4.0

0 commit comments

Comments
 (0)