Permalink
Browse files

Fixed the dispatch.fcgi use of a logger

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@981 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 546f30f commit 4043b5cdb3152f09727b3fb0a5b43679cdea7406 @dhh dhh committed Mar 23, 2005
Showing with 14 additions and 8 deletions.
  1. +5 −0 railties/CHANGELOG
  2. +9 −8 railties/dispatches/dispatch.fcgi
View
5 railties/CHANGELOG
@@ -1,3 +1,8 @@
+*SVN*
+
+* Fixed the dispatch.fcgi use of a logger
+
+
*0.11.0* (22th March, 2005)
* Removed SCRIPT_NAME from the WEBrick environment to prevent conflicts with PATH_INFO #896 [Nicholas Seckar]
View
17 railties/dispatches/dispatch.fcgi
@@ -1,26 +1,27 @@
#!/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
require File.dirname(__FILE__) + "/../config/environment"
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

0 comments on commit 4043b5c

Please sign in to comment.