Asked By – Justin Grant
How can I send trace messages to the console (like
manage.py runserver, but have those messages sent to a log file when I’m running the app under Apache?
I reviewed Django logging and although I was impressed with its flexibility and configurability for advanced uses, I’m still stumped with how to handle my simple use-case.
Now we will see solution for issue: Python/Django: log to console under runserver, log to file under Apache
Text printed to stderr will show up in httpd’s error log when running under mod_wsgi. You can either use
print >>sys.stderr, 'Goodbye, cruel world!'
This question is answered By – Ignacio Vazquez-Abrams
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0