Change production logging configuration:
- disable "Invalid HTTP_HOST" messages - separate error emails (rely on Sentry)
This commit is contained in:
		| @ -263,14 +263,68 @@ LEAFLET_CONFIG = { | ||||
|     }, | ||||
| } | ||||
|  | ||||
| # Sentry - Error Reporting | ||||
| # Error reporting & logging | ||||
| RAVEN_CONFIG = { | ||||
|     'dsn': os.getenv("RAVEN_DSN", 'https://296dda892e6e4838835a2330dd621569:10943d15104244d683fe5ccc0c898386@sentry.io/227480'), | ||||
|     'dsn': os.getenv("RAVEN_DSN", ''), | ||||
|     # If you are using git, you can also automatically configure the | ||||
|     # release based on the git info. | ||||
|     'release': raven.fetch_git_sha(os.path.dirname(os.pardir)), | ||||
| } | ||||
|  | ||||
| LOGGING = { | ||||
|     'version': 1, | ||||
|     'disable_existing_loggers': True, | ||||
|     'root': { | ||||
|         'level': 'WARNING', | ||||
|         'handlers': ['sentry'], | ||||
|     }, | ||||
|     'formatters': { | ||||
|         'verbose': { | ||||
|             'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' | ||||
|         }, | ||||
|     }, | ||||
|     'handlers': { | ||||
|         'null': { | ||||
|             'level': 'DEBUG', | ||||
|             'class': 'logging.NullHandler', | ||||
|         }, | ||||
|         'sentry': { | ||||
|             'level': 'ERROR', | ||||
|             'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler', | ||||
|         }, | ||||
|         'console': { | ||||
|             'level': 'DEBUG', | ||||
|             'class': 'logging.StreamHandler', | ||||
|             'formatter': 'verbose' | ||||
|         } | ||||
|     }, | ||||
|     'loggers': { | ||||
|         # Silence SuspiciousOperation.DisallowedHost exception ('Invalid | ||||
|         # HTTP_HOST' header messages). Set the handler to 'null' so we don't | ||||
|         # get those annoying emails. | ||||
|         # https://www.calazan.com/how-to-disable-the-invalid-http_host-header-emails-in-django/ | ||||
|         'django.security.DisallowedHost': { | ||||
|             'handlers': ['null'], | ||||
|             'propagate': False, | ||||
|         }, | ||||
|         'django.db.backends': { | ||||
|             'level': 'ERROR', | ||||
|             'handlers': ['console'], | ||||
|             'propagate': False, | ||||
|         }, | ||||
|         'raven': { | ||||
|             'level': 'DEBUG', | ||||
|             'handlers': ['console'], | ||||
|             'propagate': False, | ||||
|         }, | ||||
|         'sentry.errors': { | ||||
|             'level': 'DEBUG', | ||||
|             'handlers': ['console'], | ||||
|             'propagate': False, | ||||
|         }, | ||||
|     }, | ||||
| } | ||||
|  | ||||
| # Avatars | ||||
| AVATAR_GRAVATAR_DEFAULT = "mm" | ||||
| AVATAR_CLEANUP_DELETED = True | ||||
|  | ||||
		Reference in New Issue
	
	Block a user