diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/cve_controller.rb | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 68d353b..871a016 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -26,4 +26,10 @@ class ApplicationController < ActionController::Base logger.warn "[#{Time.now.rfc2822}] UNAUTHORIZED ACCESS by #{current_user.login} from #{request.remote_ip}: #{msg}" redirect_to :controller => '/index', :action => 'error', :type => 'access' end + + def log_error(error) + caller[0] =~ /`([^']*)'/ and where = $1 + logger.error "[#{where}] #{error.class}: #{error.to_s}" + logger.info error.backtrace.join("\n") + end end diff --git a/app/controllers/cve_controller.rb b/app/controllers/cve_controller.rb index 7423b27..d4cf2e5 100644 --- a/app/controllers/cve_controller.rb +++ b/app/controllers/cve_controller.rb @@ -55,6 +55,7 @@ class CveController < ApplicationController render :layout => false rescue Exception => e + log_error e render :text => e.message, :status => 500 end @@ -92,6 +93,7 @@ class CveController < ApplicationController render :text => "ok" rescue Exception => e + log_error e render :text => e.message, :status => 500 end @@ -115,6 +117,7 @@ class CveController < ApplicationController render :text => "ok" rescue Exception => e + log_error e render :text => e.message, :status => 500 end |