Deprecated / Unmaintained - This project is no longer maintained. Consider using mozilla-services/python-dockerflow instead.
This package provides two things:
-
mozilla_cloud_services_logger.formatters.JsonLogFormatter
: a Python logging Formatter that produces messages following the JSON schema for a common application logging format defined by Mozilla Cloud Services. -
mozilla_cloud_services_logger.django.middleware.RequestSummaryLogger
: Django middleware that emits therequest.summary
log event on every request.
Django settings.py
:
MIDDLEWARE_CLASSES = (
# ...
'mozilla_cloud_services_logger.django.middleware.RequestSummaryLogger',
# ...
)
LOGGING = {
'version': 1,
'formatters': {
'json': {
'()': 'mozilla_cloud_services_logger.formatters.JsonLogFormatter',
'logger_name': 'MySiteName'
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'json'
},
},
'loggers': {
'request.summary': {
'handlers': ['console'],
'level': 'DEBUG',
},
}
}
pip install jsonschema testfixtures
python tests.py