views:

45

answers:

1

I want to log 404 and 500 errors in a pylons app before they redirect to my custom error message (/error/document).

My problem is that since Pylons does the redirect, I am unable to determine the page on which the error occurred inside the error controller. So without building a parser for the paster.log I don't know a good way to selectively log just the few relevant pieces of data I want: url, referring page, and stack trace.

Ideally, I would like to access the page the error occurred on, the referring page, as well as the full stack trace and throw that into a couchdb for some quick and easy reports.

A: 

For custom error handling i think you should look at ErrorHandler and StatusCodeRedirect (from pylons.middleware) and maybe make your own class based on them?

Maciej Kucharz