Reputation: 16450
In django with the DEBUG
set to true when you POST and something is wrong, you'll see the error message as a webpage with sufficient details. But this is on the client side (browser). Is there a way to see the same error on the server?
We have a mobile application which POSTs to the server and doesn't have access to log or browser. Can I catch the error it gets on the server?
Upvotes: 1
Views: 44
Reputation: 4159
Add this to your settings.py:
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s [%(asctime)s] %(module)s %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
},
'loggers': {
'django': {
'handlers': ['console'],
'propagate': True,
'level': 'DEBUG',
},
}
}
the console will show the error details
Upvotes: 1
Reputation: 1174
Look at https://docs.djangoproject.com/en/1.7/howto/error-reporting/
Any time an error is raised, you can get an email or write to a file, with the information about the error.
Upvotes: 1