Skip to content

Commit

Permalink
Added referer to error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
martent committed Oct 3, 2013
1 parent 2bc99a2 commit 8ccffb0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ def action_missing(method, *args)
end

def not_found(exception = "404")
logger.warn "#{exception} #{request.fullpath}"
logger.warn "Exception: #{exception}"
logger.warn " Full path: #{request.fullpath}"
logger.warn " Referer: #{request.referer}"
reset_body_classes
render template: "404", status: 404
end

def error_page(exception = "500", msg = "Prova att navigera med menyn ovan.")
logger.error("Exception: #{exception}\n" +
"#{' ' * 32 }User id: #{session[:user_id] ? session[:user_id] : 'not logged in'}\n" +
"#{' ' * 32 }Params: #{params}")
logger.error "Exception: #{exception}"
logger.error " User id: #{session[:user_id] ? session[:user_id] : 'not logged in'}"
logger.error " Referer: #{request.referer}"
logger.error " Params: #{params}"
reset_body_classes
@msg = msg
render template: "500", status: 500
Expand Down

0 comments on commit 8ccffb0

Please sign in to comment.