-
-
Save liquidgenius/1fdf600d3d2be5b94ea761cd4b9af65f to your computer and use it in GitHub Desktop.
logging flask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'filters': {}, | |
'formatters': { | |
'syslog': { | |
'format': '%(asctime)s ' + HOSTNAME_SHORT + | |
' %(name)s: %(levelname)s: %(message)s', | |
'datefmt': '%b %d %H:%M:%S', | |
} | |
}, | |
'handlers': { | |
'papertrail': { | |
'level': 'INFO', | |
'class': 'logging.handlers.SysLogHandler', | |
'address': ('logs.papertrailapp.com', 10429), | |
'formatter': 'syslog' | |
}, | |
'logfile': { | |
'class': 'logging.handlers.TimedRotatingFileHandler', | |
'level': 'INFO', | |
'formatter': 'syslog', | |
'when': 'midnight', | |
'backupCount': 5, | |
'filename': '/var/log/log_file.log', | |
}, | |
}, | |
'loggers': { | |
'gunicorn.error': { | |
'handlers': ['logfile', 'papertrail'], | |
}, | |
'infoed': { | |
'handlers': ['logfile', 'papertrail'], | |
}, | |
'celery.task': { | |
'handlers': ['papertrail'], | |
'level': 'INFO' | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment