Browse Source

HOT-FIX: adiciona logging de erros não tratados

pull/2423/head
Edward Ribeiro 6 years ago
parent
commit
dff82278a9
  1. 13
      sapl/settings.py

13
sapl/settings.py

@ -15,6 +15,7 @@ See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
""" """
import logging import logging
import socket import socket
import sys
from decouple import config from decouple import config
from dj_database_url import parse as db_url from dj_database_url import parse as db_url
@ -335,12 +336,16 @@ LOGGING = {
} }
def excepthook(*args): def uncaught_exceptions(type, value, error_traceback):
logging.getLogger(BASE_DIR.name).error( import traceback
'Uncaught exception:', exc_info=args) logger = logging.getLogger(__name__)
error_msg = ''.join(traceback.format_tb(error_traceback))
logger.error(error_msg)
print(error_msg)
# sys.excepthook = excepthook"""
# captura exceções que não foram tratadas
sys.excepthook = uncaught_exceptions
PASSWORD_HASHERS = [ PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher', # default 'django.contrib.auth.hashers.PBKDF2PasswordHasher', # default

Loading…
Cancel
Save