Docs for log_overrider
This commit is contained in:
parent
d002c14aab
commit
ce2518ea82
1 changed files with 11 additions and 0 deletions
|
|
@ -1,4 +1,7 @@
|
||||||
class ActionView::LogSubscriber
|
class ActionView::LogSubscriber
|
||||||
|
|
||||||
|
# In order to be more friendly to Splunk, which we use for log analysis,
|
||||||
|
# we override a few logging methods. There are not overriden if enable_splunk_logging is set to false in config/application.yml
|
||||||
def render_template(event)
|
def render_template(event)
|
||||||
count = event.payload[:count] || 1
|
count = event.payload[:count] || 1
|
||||||
hash = {:event => :render,
|
hash = {:event => :render,
|
||||||
|
|
@ -18,6 +21,8 @@ end
|
||||||
module ActionDispatch
|
module ActionDispatch
|
||||||
class ShowExceptions
|
class ShowExceptions
|
||||||
private
|
private
|
||||||
|
# This override logs in a format Splunk can more easily understand.
|
||||||
|
# @see ActionView::LogSubscriber#render_template
|
||||||
def log_error(exception)
|
def log_error(exception)
|
||||||
return unless logger
|
return unless logger
|
||||||
|
|
||||||
|
|
@ -40,6 +45,8 @@ class ActionController::LogSubscriber
|
||||||
#noop
|
#noop
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This override logs in a format Splunk can more easily understand.
|
||||||
|
# @see ActionView::LogSubscriber#render_template
|
||||||
def process_action(event)
|
def process_action(event)
|
||||||
payload = event.payload
|
payload = event.payload
|
||||||
additions = ActionController::Base.log_process_action(payload)
|
additions = ActionController::Base.log_process_action(payload)
|
||||||
|
|
@ -68,6 +75,8 @@ end
|
||||||
module Rails
|
module Rails
|
||||||
module Rack
|
module Rack
|
||||||
class Logger
|
class Logger
|
||||||
|
# This override logs in a format Splunk can more easily understand.
|
||||||
|
# @see ActionView::LogSubscriber#render_template
|
||||||
def before_dispatch(env)
|
def before_dispatch(env)
|
||||||
request = ActionDispatch::Request.new(env)
|
request = ActionDispatch::Request.new(env)
|
||||||
path = request.fullpath
|
path = request.fullpath
|
||||||
|
|
@ -80,6 +89,8 @@ end
|
||||||
|
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
class LogSubscriber
|
class LogSubscriber
|
||||||
|
# This override logs in a format Splunk can more easily understand.
|
||||||
|
# @see ActionView::LogSubscriber#render_template
|
||||||
def sql(event)
|
def sql(event)
|
||||||
self.class.runtime += event.duration
|
self.class.runtime += event.duration
|
||||||
return unless logger.info?
|
return unless logger.info?
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue