lib/ahoy.rb in ahoy_matey-1.2.0 vs lib/ahoy.rb in ahoy_matey-1.2.1
- old
+ new
@@ -1,6 +1,7 @@
require "rails"
+require "active_support/core_ext"
require "addressable/uri"
require "browser"
require "geocoder"
require "referer-parser"
require "user_agent_parser"
@@ -22,11 +23,10 @@
require "ahoy/stores/active_record_store"
require "ahoy/stores/active_record_token_store"
require "ahoy/stores/log_store"
require "ahoy/stores/fluentd_store"
require "ahoy/stores/mongoid_store"
-require "ahoy/logger_silencer"
require "ahoy/engine"
require "ahoy/warden" if defined?(Warden)
# background jobs
begin
@@ -83,11 +83,18 @@
end
ActionController::Base.send :include, Ahoy::Controller
ActiveRecord::Base.send(:extend, Ahoy::Model) if defined?(ActiveRecord)
-Logger.send :include, Ahoy::LoggerSilencer
-
+# ensure logger silence will not be added by activerecord-session_store
+# otherwise, we get SystemStackError: stack level too deep
begin
- require "syslog/logger"
- Syslog::Logger.send :include, Ahoy::LoggerSilencer
-rescue LoadError; end
+ require "active_record/session_store/extension/logger_silencer"
+rescue LoadError
+ require "ahoy/logger_silencer"
+ Logger.send :include, Ahoy::LoggerSilencer
+
+ begin
+ require "syslog/logger"
+ Syslog::Logger.send :include, Ahoy::LoggerSilencer
+ rescue LoadError; end
+end