Commit 38ef93103285284c110c8a93bc2a93dd78312c45
1 parent
905d2dd5
Exists in
master
and in
29 other branches
ActionItem953: logging more information
Logging Referer and User-Agent to enable a better debugging.
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
app/controllers/application.rb
| @@ -2,6 +2,15 @@ | @@ -2,6 +2,15 @@ | ||
| 2 | # available in all controllers. | 2 | # available in all controllers. |
| 3 | class ApplicationController < ActionController::Base | 3 | class ApplicationController < ActionController::Base |
| 4 | 4 | ||
| 5 | + def log_processing | ||
| 6 | + super | ||
| 7 | + return unless ENV['RAILS_ENV'] == 'production' | ||
| 8 | + if logger && logger.info? | ||
| 9 | + logger.info(" HTTP Referer: #{request.referer}") | ||
| 10 | + logger.info(" User Agent: #{request.user_agent}") | ||
| 11 | + end | ||
| 12 | + end | ||
| 13 | + | ||
| 5 | helper :document | 14 | helper :document |
| 6 | helper :language | 15 | helper :language |
| 7 | 16 |