Handling and logging exceptions in TG2

10 views
Skip to first unread message

James

unread,
Oct 23, 2009, 9:03:49 AM10/23/09
to TurboGears
Hi,
This is a two part question.

Firstly, I'd like to consistently log exceptions from controller
methods to a file - at the moment they're not logged at all when debug
= true, and they're logged to to stderr when in production.

Although I could redirect stderr to a file, I'd ideally like control
over the formatting and so on - the same sort of controls given for
standard logging.

Secondly, how do I customise the error handling code from various
exposed methods? I'm used to error and exception handler decoration in
TG1: what's the analog in TG2?

Thanks!
James

Diez B. Roggisch

unread,
Oct 23, 2009, 11:33:51 AM10/23/09
to turbo...@googlegroups.com
On Friday 23 October 2009 15:03:49 James wrote:
> Hi,
> This is a two part question.
>
> Firstly, I'd like to consistently log exceptions from controller
> methods to a file - at the moment they're not logged at all when debug
> = true, and they're logged to to stderr when in production.
>
> Although I could redirect stderr to a file, I'd ideally like control
> over the formatting and so on - the same sort of controls given for
> standard logging.

You can try & have a look at our weberror enhancements + exception-viewer,
found on bitbucket:

http://bitbucket.org/deets/ablweberror/
http://bitbucket.org/deets/ablexcser/
http://bitbucket.org/deets/ablexceptionviewer/


These dump exceptions as XML-files with close as much information as the local
debug view, send out emails to developers on crashes, and allow browsing
through the exceptions similar to what you are used from debug-view.

The code is in use for months at our company, however it might be that it
still has some proprietary quirks, and is not well documented - but if you
like to give it a shot & give some feedback, that might improve.

>
> Secondly, how do I customise the error handling code from various
> exposed methods? I'm used to error and exception handler decoration in
> TG1: what's the analog in TG2?

No idea, never used it in TG1 the first place.

Diez

Reply all
Reply to author
Forward
0 new messages