Permalink
Browse files

make config compatible with servlet setup

  • Loading branch information...
1 parent 974f621 commit 30931df027ed2a4cc10bc66ad47fc7ddc24ade9c @mkristian committed Mar 16, 2011
Showing with 2 additions and 10 deletions.
  1. +2 −10 lib/slf4r/slf4r_railtie.rb
View
@@ -1,9 +1,6 @@
class Slf4rRailtie < Rails::Railtie
- config.before_configuration do |app|
- #if defined?(Slf4r)
- # require 'slf4r/ruby_logger' unless defined?(::Slf4r::LoggerFacade)
- #end
+ initializer "set_servlet_logger", :after => :initialize_logger do |app|
if defined?(Slf4r::LoggerFacade)
@logger = (Rails.logger = setup_logger(Rails))
app.config.logger = @logger
@@ -17,12 +14,7 @@ class Slf4rRailtie < Rails::Railtie
else
@logger.instance_variable_get(:@logger).class
end
-
- end
- end
-
- config.after_initialize do |app|
- unless defined?(Slf4r::LoggerFacade)
+ else
require 'slf4r/wrapped_logger'
Slf4r::LoggerFacade4WrappedLogger.logger = Rails.logger
puts "setup slf4r logger wrapper"

0 comments on commit 30931df

Please sign in to comment.