librelist archives

« back to archive

Logging application errors with Flask

Logging application errors with Flask

From:
Raj Nathani
Date:
2012-11-21 @ 08:49
during development with app.debug set to true whenever there's an errora 
whole traceback is shown which is awesome. when deployed is there a quick 
and simple way built in flask to log these errors when they occur 
withouthaving to surround code of the called functions/classes with a 
try-except block? 		 	   		  

Re: [flask] Logging application errors with Flask

From:
kracekumar ramaraju
Date:
2012-11-21 @ 08:56
Have you looked into this
http://flask.pocoo.org/docs/errorhandling/#logging-to-a-file

On Wed, Nov 21, 2012 at 2:19 PM, Raj Nathani <raj_n19@hotmail.com> wrote:

> during development with app.debug set to true whenever there's an error
> a whole traceback is shown which is awesome. when deployed is there a
> quick and simple way built in flask to log these errors when they occur
> without
> having to surround code of the called functions/classes with a try-except
> block?
>



-- 
*
Thanks & Regards

"Talk is cheap, show me the code" -- Linus Torvalds
kracekumar
www.kracekumar.com
*

Re: [flask] Logging application errors with Flask

From:
Raj Nathani
Date:
2012-11-21 @ 09:18
thank you, i'll try that out

Date: Wed, 21 Nov 2012 14:26:11 +0530
From: kracethekingmaker@gmail.com
Subject: Re: [flask] Logging application errors with Flask
To: flask@librelist.com

Have you looked into this 
http://flask.pocoo.org/docs/errorhandling/#logging-to-a-file 

On Wed, Nov 21, 2012 at 2:19 PM, Raj Nathani <raj_n19@hotmail.com> wrote:




during development with app.debug set to true whenever there's an errora 
whole traceback is shown which is awesome. when deployed is there a quick 
and simple way built in flask to log these errors when they occur without
having to surround code of the called functions/classes with a try-except 
block? 		 	   		  


-- 
Thanks & Regards
"Talk is cheap, show me the code" -- Linus Torvalds
kracekumarwww.kracekumar.com
 		 	   		  

Re: [flask] Logging application errors with Flask

From:
Raj Nathani
Date:
2012-11-21 @ 09:19
edd thanks for the advise :)

Date: Wed, 21 Nov 2012 09:10:46 +0000
From: me@eddrobinson.net
Subject: Re: [flask] Logging application errors with Flask
To: flask@librelist.com

As Kracekuma says, there are ways of handling logging in production apps 
(I also use SMS/email logging for errors).
However, I would just add that I don't think it’s a good idea to let 
exceptions get raised without catching them...
Aside from catastrophic failure, what's the use-case for letting your 
application terminate itself due to an uncaught exception?
Cheers,Edd


On 21 Nov 2012, at 08:49, Raj Nathani <raj_n19@hotmail.com> wrote:




during development with app.debug set to true whenever there's an errora 
whole traceback is shown which is awesome. when deployed is there a quick 
and simple way built in flask to log these errors when they occur 
withouthaving to surround code of the called functions/classes with a 
try-except block? 		 	   		  
 		 	   		  

Re: [flask] Logging application errors with Flask

From:
Edd Robinson
Date:
2012-11-21 @ 09:10
As Kracekuma says, there are ways of handling logging in production apps 
(I also use SMS/email logging for errors).

However, I would just add that I don't think it’s a good idea to let 
exceptions get raised without catching them...

Aside from catastrophic failure, what's the use-case for letting your 
application terminate itself due to an uncaught exception?

Cheers,
Edd



On 21 Nov 2012, at 08:49, Raj Nathani <raj_n19@hotmail.com> wrote:

> during development with app.debug set to true whenever there's an error
> a whole traceback is shown which is awesome. when deployed is there a 
> quick and simple way built in flask to log these errors when they occur without
> having to surround code of the called functions/classes with a try-except block?

Re: [flask] Logging application errors with Flask

From:
Matt Good
Date:
2012-11-21 @ 18:33
An exception will generally not cause a Flask application to terminate. 
Flask will catch the error and send a 500 error page response. 

For production error logging, I'm very happy with Sentry, which is a 
web-based app that can captured detailed tracebacks, including things like
local variables, and the HTTP data at the time of the error. It's the next
best thing to the development debugger. 

You can use Sentry easily with Flask via the Raven client library:
http://raven.readthedocs.org/en/latest/config/flask.html

Sentry is open source:
http://sentry.rtfd.org

And there is also a paid hosted solution available:
http://getsentry.com/welcome/


On Nov 21, 2012, at 1:10 AM, Edd Robinson <me@eddrobinson.net> wrote:

> As Kracekuma says, there are ways of handling logging in production apps
(I also use SMS/email logging for errors).
> 
> However, I would just add that I don't think it’s a good idea to let 
exceptions get raised without catching them...
> 
> Aside from catastrophic failure, what's the use-case for letting your 
application terminate itself due to an uncaught exception?
> 
> Cheers,
> Edd
> 
> 
> 
> On 21 Nov 2012, at 08:49, Raj Nathani <raj_n19@hotmail.com> wrote:
> 
>> during development with app.debug set to true whenever there's an error
>> a whole traceback is shown which is awesome. when deployed is there a 
>> quick and simple way built in flask to log these errors when they occur without
>> having to surround code of the called functions/classes with a 
try-except block?

Re: [flask] Logging application errors with Flask

From:
dorian i
Date:
2012-12-01 @ 00:31
+1 for sentry.

On Wed, Nov 21, 2012 at 7:33 PM, Matt Good <matt@matt-good.net> wrote:

> An exception will generally not cause a Flask application to terminate.
> Flask will catch the error and send a 500 error page response.
>
> For production error logging, I'm very happy with Sentry, which is a
> web-based app that can captured detailed tracebacks, including things like
> local variables, and the HTTP data at the time of the error. It's the next
> best thing to the development debugger.
>
> You can use Sentry easily with Flask via the Raven client library:
> http://raven.readthedocs.org/en/latest/config/flask.html
>
> Sentry is open source:
> http://sentry.rtfd.org
>
> And there is also a paid hosted solution available:
> http://getsentry.com/welcome/
>
>
> On Nov 21, 2012, at 1:10 AM, Edd Robinson <me@eddrobinson.net> wrote:
>
> As Kracekuma says, there are ways of handling logging in production apps
> (I also use SMS/email logging for errors).
>
> However, I would just add that I don't think it’s a good idea to let
> exceptions get raised without catching them...
>
> Aside from catastrophic failure, what's the use-case for letting your
> application terminate itself due to an uncaught exception?
>
> Cheers,
> Edd
>
>
>
> On 21 Nov 2012, at 08:49, Raj Nathani <raj_n19@hotmail.com> wrote:
>
> during development with app.debug set to true whenever there's an error
> a whole traceback is shown which is awesome. when deployed is there a
> quick and simple way built in flask to log these errors when they occur
> without
> having to surround code of the called functions/classes with a try-except
> block?
>
>