I'm noticing that my development.log messages are not showing the usual complete logging per request/response when I am catching exceptions from my controllers using rescue_from. I was wondering if anyone has ever encountered this issue before. I'm using Rails 2.2.2.
Processing DomainsController#show to xml (for 127.0.0.1 at 2009-04-03 16:41:38) [GET] Parameters: {"format"=>"xml", "action"=>"show", "id"=>"test6", "controller"=>"domains"} SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 Account Columns (3.6ms) SHOW FIELDS FROM `accounts` Domain Columns (1.8ms) SHOW FIELDS FROM `domains` Domain Load (0.8ms) SELECT * FROM `domains` WHERE (`domains`.`domainname` = 'test6') LIMIT 1
I would expect to see a final confirmation of the HTTP status code, but instead I see the above without it, but the correct 404 status code is returned back to my client program. Completed in 81ms (View: 0, DB: 2) | 404 Not Found [http://localhost/services/domains/test6\]
My rescue_from implementation:
class ApplicationController < ActionController::Base rescue_from InvalidDomainError, :with => :handle404NotFound ...
def handle404NotFound(e) render :xml => generateErrorXML(e.to_s), :status => 404 end
def generateErrorXML(error_str) "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <error> <method>#{request.method}</method> <request>#{request.request_uri}</request> <reason>#{error_str}</reason> </error>" end
Thanks in advance, Steve