summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/initializers/lograge.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb
index 114c1cb512f..49fdd23064c 100644
--- a/config/initializers/lograge.rb
+++ b/config/initializers/lograge.rb
@@ -1,3 +1,21 @@
+# Monkey patch lograge until https://github.com/roidrage/lograge/pull/241 is released
+module Lograge
+ class RequestLogSubscriber < ActiveSupport::LogSubscriber
+ def strip_query_string(path)
+ index = path.index('?')
+ index ? path[0, index] : path
+ end
+
+ def extract_location
+ location = Thread.current[:lograge_location]
+ return {} unless location
+
+ Thread.current[:lograge_location] = nil
+ { location: strip_query_string(location) }
+ end
+ end
+end
+
# Only use Lograge for Rails
unless Sidekiq.server?
filename = File.join(Rails.root, 'log', "#{Rails.env}_json.log")