Changeset 7626
- Timestamp:
- 09/25/07 03:47:37 (1 year ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support.rb (modified) (1 diff)
- trunk/activesupport/lib/active_support/buffered_logger.rb (added)
- trunk/activesupport/lib/active_support/clean_logger.rb (modified) (1 diff)
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/dispatcher.rb (modified) (3 diffs)
- trunk/railties/lib/initializer.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r7621 r7626 1 1 *SVN* 2 3 * Added ActiveSupport::BufferedLogger as a duck-typing alternative (albeit with no formatter) to the Ruby Logger, which provides a very nice speed bump (inspired by Ezra's buffered logger) [DHH] 2 4 3 5 * Object#instance_exec produces fewer garbage methods. [Mauricio Fernandez] trunk/activesupport/lib/active_support.rb
r7473 r7626 30 30 31 31 require 'active_support/core_ext' 32 32 33 require 'active_support/clean_logger' 34 require 'active_support/buffered_logger' 35 33 36 require 'active_support/dependencies' 34 37 require 'active_support/deprecation' trunk/activesupport/lib/active_support/clean_logger.rb
r7565 r7626 12 12 # 13 13 # logger.datetime_format = "%Y-%m-%d" 14 # 15 # Note: This logger is deprecated in favor of ActiveSupport::BufferedLogger 14 16 class Logger 15 17 # Set to false to disable the silencer trunk/railties/CHANGELOG
r7623 r7626 1 1 *SVN* 2 3 * Changed the default logger from Ruby's own Logger with the clean_logger extensions to ActiveSupport::BufferedLogger for performance reasons [DHH]. (You can change it back with config.logger = Logger.new("/path/to/log", level).) 2 4 3 5 * Added a default 422.html page to be rendered when ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved, or ActionController::InvalidAuthenticityToken is raised [DHH] trunk/railties/lib/dispatcher.rb
r7475 r7626 39 39 controller.process(request, response).out(output) 40 40 end 41 rescue Exception => exception # errors from CGI dispatch41 rescue Exception => exception # errors from CGI dispatch 42 42 failsafe_response(cgi, output, '500 Internal Server Error', exception) do 43 43 controller ||= (ApplicationController rescue ActionController::Base) … … 45 45 end 46 46 ensure 47 # Do not give a failsafe response here. 47 # Do not give a failsafe response here 48 flush_logger 48 49 reset_after_dispatch 49 50 end … … 166 167 RAILS_DEFAULT_LOGGER 167 168 else 168 Logger.new($stderr)169 ActiveSupport::BufferedLogger.new($stderr) 169 170 end 171 end 172 173 def flush_logger 174 RAILS_DEFAULT_LOGGER.flush if defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER.respond_to?(:flush) 170 175 end 171 176 end trunk/railties/lib/initializer.rb
r7564 r7626 241 241 unless logger = configuration.logger 242 242 begin 243 logger = Logger.new(configuration.log_path) 244 logger.level = Logger.const_get(configuration.log_level.to_s.upcase) 245 rescue StandardError 246 logger = Logger.new(STDERR) 247 logger.level = Logger::WARN 243 logger = ActiveSupport::BufferedLogger.new(configuration.log_path) 244 logger.level = ActiveSupport::BufferedLogger.const_get(configuration.log_level.to_s.upcase) 245 logger.auto_flushing = false if configuration.environment == "production" 246 rescue StandardError =>e 247 logger = ActiveSupport::BufferedLogger.new(STDERR) 248 logger.level = ActiveSupport::BufferedLogger::WARN 248 249 logger.warn( 249 250 "Rails Error: Unable to access log file. Please ensure that #{configuration.log_path} exists and is chmod 0666. " +