Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
How do I get tracebacks printed to terminal?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Markus Barth  
View profile  
 More options Nov 23 2010, 3:48 pm
From: Markus Barth <naturalparkdelseg...@gmail.com>
Date: Tue, 23 Nov 2010 12:48:42 -0800 (PST)
Local: Tues, Nov 23 2010 3:48 pm
Subject: How do I get tracebacks printed to terminal?
I am using quite a lot of asynchronous calls for updating a page. The
problem is that this way you never see a traceback. In turbogears the
development server prints all tracebacks to the terminal. Is there any
way to get a similar behaviour with django?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Javier Guerra Giraldez  
View profile  
 More options Nov 23 2010, 5:19 pm
From: Javier Guerra Giraldez <jav...@guerrag.com>
Date: Tue, 23 Nov 2010 17:19:51 -0500
Local: Tues, Nov 23 2010 5:19 pm
Subject: Re: How do I get tracebacks printed to terminal?
On Tue, Nov 23, 2010 at 3:48 PM, Markus Barth

<naturalparkdelseg...@gmail.com> wrote:
> I am using quite a lot of asynchronous calls for updating a page. The
> problem is that this way you never see a traceback. In turbogears the
> development server prints all tracebacks to the terminal. Is there any
> way to get a similar behaviour with django?

firebug can show the content of any request/response, including AJAX
ones.  it also renders any HTML content, like those generated by the
Django error pages

--
Javier


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Barth  
View profile  
 More options Nov 23 2010, 5:23 pm
From: Markus Barth <naturalparkdelseg...@gmail.com>
Date: Tue, 23 Nov 2010 14:23:29 -0800 (PST)
Local: Tues, Nov 23 2010 5:23 pm
Subject: Re: How do I get tracebacks printed to terminal?
I have just found a post from beginning of last year pointing out that
this feature got "lost" during the transition from 0.9 to 1.0. I have
digged a bit through the code but must admit that fixing this
definitely should be done by someone who is familiar with django
internals.

Tracebacks are one of the strongest features of python and without
them the slogan that Django is for "perfectionists with deadlines" is
not applicable in case of ajax/json apps - because you spend more time
trying to blindly find your bug than actually developping.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Barth  
View profile  
 More options Nov 23 2010, 5:33 pm
From: Markus Barth <naturalparkdelseg...@gmail.com>
Date: Tue, 23 Nov 2010 14:33:10 -0800 (PST)
Local: Tues, Nov 23 2010 5:33 pm
Subject: Re: How do I get tracebacks printed to terminal?

On 23 nov, 23:19, Javier Guerra Giraldez <jav...@guerrag.com> wrote:

> On Tue, Nov 23, 2010 at 3:48 PM, Markus Barth

> <naturalparkdelseg...@gmail.com> wrote:
> > I am using quite a lot of asynchronous calls for updating a page. The
> > problem is that this way you never see a traceback. In turbogears the
> > development server prints all tracebacks to the terminal. Is there any
> > way to get a similar behaviour with django?

> firebug can show the content of any request/response, including AJAX
> ones.  it also renders any HTML content, like those generated by the
> Django error pages

> --
> Javier

This is only helpful if the request is answerered by the server, but
as soon as you have an exception, all you see on the console is a 500
Error and Firebug  tells you "status: aborted"

For example I have just spend an hour chasing a bug just to find out
that syncdb didn't sync a table. With a traceback I would have seen
the problem within seconds

Anyway, thanks for the hint


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Barth  
View profile  
 More options Nov 23 2010, 5:39 pm
From: Markus Barth <naturalparkdelseg...@gmail.com>
Date: Tue, 23 Nov 2010 14:39:52 -0800 (PST)
Local: Tues, Nov 23 2010 5:39 pm
Subject: Re: How do I get tracebacks printed to terminal?

On 23 nov, 23:33, Markus Barth <naturalparkdelseg...@gmail.com> wrote:

Sorry, I have to correct myself, in fact, I got the information
through firebug. Thanks a lot, that saved my day.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Reinout van Rees  
View profile  
 More options Nov 24 2010, 7:48 am
From: Reinout van Rees <rein...@vanrees.org>
Date: Wed, 24 Nov 2010 13:48:15 +0100
Local: Wed, Nov 24 2010 7:48 am
Subject: Re: How do I get tracebacks printed to terminal?
On 11/23/2010 09:48 PM, Markus Barth wrote:

> I am using quite a lot of asynchronous calls for updating a page. The
> problem is that this way you never see a traceback. In turbogears the
> development server prints all tracebacks to the terminal. Is there any
> way to get a similar behaviour with django?

You'll have to enable that yourself with some middleware, strangely.

In your app/site, add a "middleware.py":

import logging

logger = logging.getLogger(__name__)

class TracebackLoggingMiddleware(object):
     """Middleware that logs exceptions.

     See http://djangosnippets.org/snippets/421/.

     To enable it, add
     'yourapp.middleware.TracebackLoggingMiddleware' to
     your setting.py's MIDDLEWARE_CLASSES.

     """

     def process_exception(self, request, exception):
         logger.exception(repr(request))

And do the MIDDLEWARE_CLASSES thingy in the docstring.

Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Collega's gezocht!
Django/python vacature in Utrecht: http://tinyurl.com/35v34f9


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David De La Harpe Golden  
View profile  
 More options Nov 24 2010, 8:09 am
From: David De La Harpe Golden <david.delaharpe.gol...@ichec.ie>
Date: Wed, 24 Nov 2010 13:09:13 +0000
Local: Wed, Nov 24 2010 8:09 am
Subject: Re: How do I get tracebacks printed to terminal?
On 23/11/10 20:48, Markus Barth wrote:

> I am using quite a lot of asynchronous calls for updating a page. The
> problem is that this way you never see a traceback. In turbogears the
> development server prints all tracebacks to the terminal. Is there any
> way to get a similar behaviour with django?

People have already mentioned firebug's ability to show the contents
of the error response.  Note that you can also define an
exception middleware that will catch exceptions raised by your views
(but not all exceptions raised in the course of request-response
processing*) occuring during request processing and then you can e.g.
format the error into a json response, say, for less pain on the client
side.

*
(i) the obvious - an apache level error, not all that much django can do
there
(ii) Some exceptions, mostly those raised by the resolver, escape the
exception middleware, just owing to the structure of the code, see
BaseHandler.get_response() [2]. Subclassing the Handler seems to be the
least worst way to deal with that right now.

[2]
http://code.djangoproject.com/browser/django/trunk/django/core/handle...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »