Monday, August 29, 2011

Mongo prints traceback directly to stderr?

We've got an application which does lots of AJAX calls and sometimes
(intentionally) abandons the TCP connection before getting a
response. These result in django dumping a stack trace to stderr (see
example below).

The question is, why does this get written directly to stderr? It
happens in ServerHandler:

from traceback import print_exception
stderr = self.get_stderr()
print_exception(
exc_info[0], exc_info[1], exc_info[2],
self.traceback_limit, stderr
)

wouldn't it make more sense to write this to some logger, where we can
then control whether it gets printed or not? In our case, it's
perfectly normal and we'd like to completely ignore it.

-------- example stack dump ---------
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py",
line 284, in run
self.finish_response()
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py",
line 324, in finish_response
self.write(data)
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py",
line 403, in write
self.send_headers()
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py",
line 467, in send_headers
self.send_preamble()
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py",
line 385, in send_preamble
'Date: %s\r\n' % http_date()
File "/usr/lib/python2.6/socket.py", line 300, in write
self.flush()
File "/usr/lib/python2.6/socket.py", line 286, in flush
self._sock.sendall(buffer)
error: [Errno 32] Broken pipe

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment