I have a Django project where I have been logging to a file using the standard library logging module. For a variety of reasons I would like to change it so that it writes to the Apache log files. I've seen quite a bit of discussion of how to do this with mod_python, but not mod_wsgi. How do I do this for a project running under mod_wsgi?
Asked
Active
Viewed 3,310 times
12
-
Step 1. Search. http://stackoverflow.com/search?q=%5Bdjango%5D+apache+log Step 2. Read this: http://stackoverflow.com/questions/1598823/elegant-setup-of-python-logging-in-django – S.Lott Sep 29 '10 at 19:39
1 Answers
13
Mostly, we use logging and write to sys.stderr
. That seems to write to the Apache error_log.

S.Lott
- 384,516
- 81
- 508
- 779
-
Thanks. That seems to be the way to do it. The comments on this post http://djangosnippets.org/snippets/1731/ say the same thing. – David Montgomery Oct 01 '10 at 16:58
-
-
1@DavidMontgomery: the comment you link to is helpful. A currently more legible version of the same comment can be found at http://artyname.tumblr.com/post/390511693/log-django-exceptions-to-apache-error-log-in – user1071847 Oct 11 '16 at 16:30