diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-23 00:54:05 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-23 00:54:05 +0000 |
commit | 4043b5cdb3152f09727b3fb0a5b43679cdea7406 (patch) | |
tree | 829d6bb17d72ab2dfa58bc3450078bd511535c37 /railties/dispatches | |
parent | 546f30fc10d517856616720d240fed03d79ebaa5 (diff) | |
download | rails-4043b5cdb3152f09727b3fb0a5b43679cdea7406.tar.gz rails-4043b5cdb3152f09727b3fb0a5b43679cdea7406.tar.bz2 rails-4043b5cdb3152f09727b3fb0a5b43679cdea7406.zip |
Fixed the dispatch.fcgi use of a logger
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@981 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/dispatches')
-rwxr-xr-x | railties/dispatches/dispatch.fcgi | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/railties/dispatches/dispatch.fcgi b/railties/dispatches/dispatch.fcgi index ffe5b57812..683a61f4c9 100755 --- a/railties/dispatches/dispatch.fcgi +++ b/railties/dispatches/dispatch.fcgi @@ -1,12 +1,11 @@ #!/usr/local/bin/ruby -FASTCGI_CRASH_LOG_PATH = "#{RAILS_ROOT}/log/fastcgi.crash.log" - -def dispatcher_error(e, msg = "") - error_message = "[#{Time.now}] Dispatcher failed to catch: #{e} (#{e.class})\n #{e.backtrace.join("\n ")}\n#{msg}" - Logger.new(FASTCGI_CRASH_LOG_PATH).fatal(error_message) +def dispatcher_error(path,e,msg="") + error_message = + "[#{Time.now}] Dispatcher failed to catch: #{e} (#{e.class})\n #{e.backtrace.join("\n ")}\n#{msg}" + Logger.new(path).fatal(error_message) rescue Object => log_error - STDERR << "Couldn't write to #{FASTCGI_CRASH_LOG_PATH} (#{e} [#{e.class}])\n" << error_message + STDERR << "Couldn't write to #{path} (#{e} [#{e.class}])\n" << error_message end begin @@ -14,13 +13,15 @@ begin require 'dispatcher' require 'fcgi' + log_file_path = "#{RAILS_ROOT}/log/fastcgi.crash.log" + FCGI.each_cgi do |cgi| begin Dispatcher.dispatch(cgi) rescue Object => rails_error - dispatcher_error(rails_error) + dispatcher_error(log_file_path, rails_error) end end rescue Object => fcgi_error - dispatcher_error(fcgi_error, "FCGI process #{$$} killed by this error\n") + dispatcher_error(log_file_path, fcgi_error, "FCGI process #{$$} killed by this error\n") end
\ No newline at end of file |