Skip to content
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

Include logger silence from active support #270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

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

why is the info level overriden here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't remember anymore. And now it looks like it should not override it.

Unfortunately I do not have time to test this right now. Maybe later today or tomorrow

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
Loading