On Sep 26, 2:16 pm, Florian Apolloner <f.apollo...@gmail.com> wrote: > I am aware of those; but let's imagine a 3rd party library which has > no idea what a request is. In my logs I still want to know the request > (even if it's just for formatting purposes…); so I am looking for a > way to attach request specific info to __all__ logging calls done in > one request __without__ adding it to the logging call.
You might be interested in this blog post: http://plumberjack.blogspot.com/2010/09/configuring-logging-for-web.html which solves the problem you mention (attaching request-specific info, to all logging calls in a request, including calls made in 3rd party libraries you use, without having to add "extra" to logging calls). However, it requires thread-locals, which for some reason the Django core team seem to be against: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser You might regard the rest of this post OT, but ... I haven't seen any detailed evidence for the "huge threat" mentioned in that Wiki page. In fact, Graham Dumpleton, author of mod-wsgi, in this post, seems to be saying that it's not such a security threat that you need to rule out use of thread-locals: http://groups.google.com/group/django-users/msg/eb686bf30a7e4c26 To me, Graham seems right on the money. Of course, if the core team (or any one else) can point to any known exploits which take advantage of flaws in Python's thread-locals implementation, that would settle things right away :-) Even then, the answer would be to fix the hole in Python. Also - even if Django itself doesn't use thread-locals, can you be sure that any third-party library you are using doesn't do so under the covers? Regards, Vinay Sajip -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.