logjam_agent 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logjam_agent/rack/logger.rb +1 -1
- data/lib/logjam_agent/railtie.rb +33 -7
- data/lib/logjam_agent/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d02ede9be339e8cb390405fa13e3ea082029de86
|
4
|
+
data.tar.gz: 2c6a677da91a71d150e2e4148dd2ad3f7597a4c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae77ad1d26aaea1f8e2cbd4e96f27ea87cfea574988a93481c9a03b560a0fa8b110fc12ebeadf307cd37f34c3cff44ddb25b05b47367c8f496068b4f806758db
|
7
|
+
data.tar.gz: e95a74079e8ca28e6e5fcc3c04e7a330ecc97718d97cfacb46bd5d037c0d988bef23020665b217dc0f592a1f71a73560ee6f5093651a2d98eb22f89ffc44fef8
|
@@ -226,7 +226,7 @@ module ActionController #:nodoc:
|
|
226
226
|
info " Parameters: #{params.inspect}" unless params.empty?
|
227
227
|
end
|
228
228
|
|
229
|
-
elsif Rails::VERSION::STRING =~ /\A(3\.2|4\.[012])/
|
229
|
+
elsif Rails::VERSION::STRING =~ /\A(3\.2|4\.[012]|5)/
|
230
230
|
|
231
231
|
# Rails 4.1 uses method_added to automatically subscribe newly
|
232
232
|
# added methods. Since start_processing is already defined, the
|
data/lib/logjam_agent/railtie.rb
CHANGED
@@ -45,8 +45,8 @@ module LogjamAgent
|
|
45
45
|
LogjamAgent.environment_name = Rails.env
|
46
46
|
LogjamAgent.auto_detect_logged_exceptions
|
47
47
|
|
48
|
-
app.config.middleware.swap(
|
49
|
-
app.config.middleware.insert_before(
|
48
|
+
app.config.middleware.swap(TimeBandits::Rack::Logger, LogjamAgent::Rack::Logger)
|
49
|
+
app.config.middleware.insert_before(LogjamAgent::Rack::Logger, LogjamAgent::Middleware)
|
50
50
|
|
51
51
|
if defined?(::ActionDispatch::RemoteIp)
|
52
52
|
app.config.middleware.delete ::ActionDispatch::RemoteIp
|
@@ -78,16 +78,16 @@ module LogjamAgent
|
|
78
78
|
# patch controller testing to create a logjam request, because middlewares aren't executed
|
79
79
|
if Rails.env.test?
|
80
80
|
ActiveSupport.on_load(:action_controller) do
|
81
|
-
|
82
|
-
|
83
|
-
def process_with_logjam(*args)
|
81
|
+
module TestWithLogjamStartRequest
|
82
|
+
def process(*args)
|
84
83
|
LogjamAgent.start_request
|
85
|
-
|
84
|
+
super
|
86
85
|
ensure
|
87
86
|
LogjamAgent.finish_request
|
88
87
|
end
|
89
|
-
alias_method_chain :process, :logjam
|
90
88
|
end
|
89
|
+
require 'action_controller/test_case'
|
90
|
+
ActionController::TestCase::Behavior.prepend TestWithLogjamStartRequest
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -107,6 +107,32 @@ module LogjamAgent
|
|
107
107
|
EVA
|
108
108
|
end
|
109
109
|
|
110
|
+
if Rails::VERSION::STRING >= "5.0"
|
111
|
+
# we want backtraces etc. logged as a single string with newlines.
|
112
|
+
# TODO: when logging with tags, we might want to have tags and
|
113
|
+
# timestamps on disk. Not sure how useful this would be, though.
|
114
|
+
ActiveSupport.on_load(:action_controller) do
|
115
|
+
ActionDispatch::DebugExceptions.class_eval do
|
116
|
+
def log_error(request, wrapper)
|
117
|
+
logger = logger(request)
|
118
|
+
return unless logger
|
119
|
+
|
120
|
+
exception = wrapper.exception
|
121
|
+
|
122
|
+
trace = wrapper.application_trace
|
123
|
+
trace = wrapper.framework_trace if trace.empty?
|
124
|
+
|
125
|
+
ActiveSupport::Deprecation.silence do
|
126
|
+
parts = [ "#{exception.class} (#{exception.message})" ]
|
127
|
+
parts.concact exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
|
128
|
+
parts.concat trace
|
129
|
+
logger.fatal parts.join("\n ")
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
110
136
|
config.after_initialize do
|
111
137
|
if LogjamAgent.ignore_render_events
|
112
138
|
ActiveSupport::Notifications.unsubscribe("render_template.action_view")
|
data/lib/logjam_agent/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logjam_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|