librelist archives

« back to archive

Logging full URL?

Logging full URL?

From:
Mark E. Haase
Date:
2012-09-23 @ 23:04
I've implemented error logging as described here:

http://flask.pocoo.org/docs/errorhandling/

This works nicely, but one drawback is that the exception message contains
the URL endpoint rather than the actual URL query. E.g. it will show 
"Exception on /helloworld [GET]" but I think it would be more useful to 
show "Exception on /helloworld?foo=bar&baz=bat [GET]". Is there a way to 
configure this?

Along these same lines, it would be nice to include post data in the error
message (truncated to some reasonable size, of course) and maybe cookie 
value?

--
Mark E. Haase

Re: [flask] Logging full URL?

From:
Amirouche Boubekki
Date:
2012-09-30 @ 17:50
Héllo,

Have you tried Raven<http://raven.readthedocs.org/en/latest/config/flask.html>it's
an interesting solution even if the server runs on Django, it's quite
easy
to setup <http://sentry.readthedocs.org/en/latest/quickstart/index.html>and
they are commercial offers to have your sentry server hosted in
another
machine. The default configuration doesn't send mail, but gather every
traceback by error type with a comprenhensive list of filters and a live
dashboard, I recommend you try it :)

Regards,

Amirouche

2012/9/24 Mark E. Haase <mark.haase@lunarline.com>

> I've implemented error logging as described here:
>
> http://flask.pocoo.org/docs/errorhandling/
>
> This works nicely, but one drawback is that the exception message contains
> the URL endpoint rather than the actual URL query. E.g. it will show
> "Exception on /helloworld [GET]" but I think it would be more useful to
> show "Exception on /helloworld?foo=bar&baz=bat [GET]". Is there a way to
> configure this?
>
> Along these same lines, it would be nice to include post data in the error
> message (truncated to some reasonable size, of course) and maybe cookie
> value?
>
> --
> Mark E. Haase
>

Re: [flask] Logging full URL?

From:
Darren Worrall
Date:
2012-09-24 @ 08:56
On 24 September 2012 00:04, Mark E. Haase <mark.haase@lunarline.com> wrote:

> I've implemented error logging as described here:
>
> http://flask.pocoo.org/docs/errorhandling/
>
> This works nicely, but one drawback is that the exception message contains
> the URL endpoint rather than the actual URL query. E.g. it will show
> "Exception on /helloworld [GET]" but I think it would be more useful to
> show "Exception on /helloworld?foo=bar&baz=bat [GET]". Is there a way to
> configure this?
>
> Along these same lines, it would be nice to include post data in the error
> message (truncated to some reasonable size, of course) and maybe cookie
> value?
>
> --
> Mark E. Haase
>

We override the log_exception call to achieve the former, you have access
to the request object so you can add in whatever you want:

https://gist.github.com/3775003