I am having issues setting up my wsgi file so I wanted to output messages to the log file. I found this page http://code.google.com/p/modwsgi/wiki/DebuggingTechniques, but when I try to use the code:
print >> sys.stderr, "application debug #3"
in my project.wsgi file, the message is not pushed to the error.log on apache restart. The site is being served correctly. What do I need to do to make the logging work?
P.S. I am on Ubuntu 10.10 serving a Django site.
The WSGI script file is normally only loaded when the first request arrives for that specific application and not automatically when processes start, ie., not when Apache is restarted. You can force it to be loaded on process start if mod_wsgi is configured appropriately, but isn’t the default. Nothing in the WSGI script file is executed on a process shutdown. To have that happen you would need to register an atexit callback. See ‘code.google.com/p/modwsgi/wiki/…;. – Graham Dumpleton
Graham Dumpleton is a genius!