Hello, im using django as my web framework. I wanna ask, how to put django log like error 500 / error code into my apache error log in server. Can anyone help me? Thanks
`
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “foo.settings”)
application = get_wsgi_application()`
If you have a system error in your Django application causing it to throw a 500, that is the response code that will be shown in your Apache log.
okay, just set ErrorLog path in httpd.conf? there is no config in python file?
You still have the ability to write logs from within your Django application. If you want to put more detailed information out than what’s available in the Apache logs, you would still need to configure that.
But if you’re only looking for the standard Apache response-code logging, then no, you don’t need to configure logging within the application.
okay, what configuation should i put in wsgi.py? or make another python file? actually i wanna put django error into apache log instead of putting error into django loggers
okay, I’ve tried to show wsgi.error when setup DEBUG= True. What if i set DEBUG=False, is still shown error on wsgi.errors or no?
Sounds like a simple enough thing to try. Why don’t you give it a shot and see what happens?