I think a really nice solution to this is to use a middleware. I've used something like this - it catches all exceptions, and writes each one's full django traceback to a database record. You can change the handling to use the logging module or whatever. I think this is great for a production environment.
Add the path to this class to your settings.MIDDLEWARE_CLASSES. class ExceptionMiddleware: def process_exception(self, request, exception): import sys from django.http import HttpResponse, HttpResponseServerError from django.views.debug import technical_500_response import datetime exc_type, exc_value, tb = sys.exc_info() # This the HTML source of the full django interactive stack trace: full_details = technical_500_response(request, exc_type, exc_value, tb).content class_name = exception.__class__.__name__ message = getattr(exception, 'message', '') url = request.build_absolute_uri() user = request.user occurred_at = datetime.datetime.now() if request.is_ajax(): return HttpResponseServerError("error") else: # Return some kind of friendly HttpResponseServerError On Apr 9, 8:56 pm, mouadino <mouad...@gmail.com> wrote: > hello Everybody . > > my probelem is that i want to make the traceback disappear when an > exception is raised . > I'm using the module logging with Django and i 'm redirecting the > output to a file and this file must contain only feedback to the > developer , and with the traceback it's not readable at all . > > so i tried in every exception to print a readable message but i have > always the traceback how print as well > example : > > try > price = decimal.Decimal(extracted_tags.get("PRICE", "0")) > if price: > product.list_price = price > > except Exception, e: > logging.exception('Unable to convert the followin price : ' + > extracted_tags.get("PRICE")) > > and in my log file i have : > > Unable to convert the followin price : " 445,54" > Traceback (most recent call last): > ........... > > can someone help me please and thanks for everything . -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.