drop mozilla-logger and all logging1.0 support (#8242)
* drop mozilla-logger and all logging1.0 support * drop (hopefully) unused SYSLOG_CSP setting * drop 'error' formatter; refactor 'debug' formatter format a little
This commit is contained in:
Родитель
da7ab46889
Коммит
cae6c3ad2f
|
@ -10,7 +10,7 @@ Logging is fun. We all want to be lumberjacks. My muscle-memory wants to put
|
|||
Plus, ``django-debug-toolbar`` can hijack the logger and show all the log
|
||||
statements generated during the last request. When ``DEBUG = True``, all logs
|
||||
will be printed to the development console where you started the server. In
|
||||
production, we're piping everything into ``syslog``.
|
||||
production, we're piping everything into ``mozlog``.
|
||||
|
||||
|
||||
Configuration
|
||||
|
@ -28,9 +28,6 @@ twiddle with these settings:
|
|||
import logging
|
||||
LOG_LEVEL = logging.WARN
|
||||
|
||||
``USE_SYSLOG``
|
||||
Set this to ``True`` if you want logging sent to syslog.
|
||||
|
||||
``USE_MOZLOG``
|
||||
Set this to ``True`` if you want logging sent to the console using mozlog
|
||||
format.
|
||||
|
|
|
@ -257,8 +257,6 @@ m2secret-py3==1.3 \
|
|||
mock==2.0.0 \
|
||||
--hash=sha256:5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1 \
|
||||
--hash=sha256:b158b6df76edd239b8208d481dc46b6afd45a846b7812ff0ce58971cf5bc8bba
|
||||
mozilla-logger==0.2 \
|
||||
--hash=sha256:085db73901ea38728ac5eb14197979ae8b9524511ba7f0d8941d70650b586ef5
|
||||
# natsort is required by amo-validator
|
||||
natsort==5.3.0 \
|
||||
--hash=sha256:69e8adfe7e509ee967c8b33279966596fba84beb763fb8d8322b387fa1836b74 \
|
||||
|
|
|
@ -96,10 +96,10 @@ def log_configure():
|
|||
cfg = {
|
||||
'version': 1,
|
||||
'filters': {},
|
||||
'formatters': dict(prod=formatters['prod']),
|
||||
'handlers': dict(syslog=handlers['syslog']),
|
||||
'formatters': dict(json=formatters['json']),
|
||||
'handlers': dict(mozlog=handlers['mozlog']),
|
||||
'loggers': {
|
||||
'z': {'handlers': ['syslog'], 'level': logging.INFO},
|
||||
'z': {'handlers': ['mozlog'], 'level': logging.INFO},
|
||||
},
|
||||
'root': {},
|
||||
# Since this configuration is applied at import time
|
||||
|
|
|
@ -46,8 +46,7 @@ CACHES = {
|
|||
}
|
||||
}
|
||||
|
||||
# For local development, we don't need syslog and mozlog loggers.
|
||||
USE_SYSLOG = False
|
||||
# For local development, we don't need mozlog loggers.
|
||||
USE_MOZLOG = False
|
||||
|
||||
# If you're not running on SSL you'll want this to be False.
|
||||
|
|
|
@ -45,10 +45,7 @@ SESSION_COOKIE_DOMAIN = ".%s" % DOMAIN
|
|||
INBOUND_EMAIL_DOMAIN = env('INBOUND_EMAIL_DOMAIN',
|
||||
default='addons-dev.allizom.org')
|
||||
|
||||
SYSLOG_TAG = "http_app_addons_dev"
|
||||
MOZLOG_NAME = SYSLOG_TAG
|
||||
SYSLOG_TAG2 = "http_app_addons_dev_timer"
|
||||
SYSLOG_CSP = "http_app_addons_dev_csp"
|
||||
MOZLOG_NAME = "http_app_addons_dev"
|
||||
|
||||
NETAPP_STORAGE_ROOT = env('NETAPP_STORAGE_ROOT')
|
||||
NETAPP_STORAGE = NETAPP_STORAGE_ROOT + '/shared_storage'
|
||||
|
|
|
@ -34,10 +34,6 @@ SESSION_COOKIE_DOMAIN = ".%s" % DOMAIN
|
|||
INBOUND_EMAIL_DOMAIN = env('INBOUND_EMAIL_DOMAIN',
|
||||
default='addons.mozilla.org')
|
||||
|
||||
SYSLOG_TAG = "http_app_addons"
|
||||
SYSLOG_TAG2 = "http_app_addons_timer"
|
||||
SYSLOG_CSP = "http_app_addons_csp"
|
||||
|
||||
NETAPP_STORAGE_ROOT = env('NETAPP_STORAGE_ROOT')
|
||||
NETAPP_STORAGE = NETAPP_STORAGE_ROOT + '/shared_storage'
|
||||
GUARDED_ADDONS_PATH = NETAPP_STORAGE_ROOT + '/guarded-addons'
|
||||
|
|
|
@ -43,9 +43,7 @@ SESSION_COOKIE_DOMAIN = ".%s" % DOMAIN
|
|||
INBOUND_EMAIL_DOMAIN = env('INBOUND_EMAIL_DOMAIN',
|
||||
default='addons.allizom.org')
|
||||
|
||||
SYSLOG_TAG = "http_app_addons_stage"
|
||||
SYSLOG_TAG2 = "http_app_addons_stage_timer"
|
||||
SYSLOG_CSP = "http_app_addons_stage_csp"
|
||||
MOZLOG_NAME = "http_app_addons_stage"
|
||||
|
||||
NETAPP_STORAGE_ROOT = env('NETAPP_STORAGE_ROOT')
|
||||
NETAPP_STORAGE = NETAPP_STORAGE_ROOT + '/shared_storage'
|
||||
|
|
|
@ -6,40 +6,17 @@ from django.conf import settings
|
|||
|
||||
import olympia.core.logger
|
||||
|
||||
|
||||
base_fmt = ('%(name)s:%(levelname)s %(message)s '
|
||||
':%(pathname)s:%(lineno)s')
|
||||
error_fmt = ('%(name)s:%(levelname)s %(request_path)s %(message)s '
|
||||
':%(pathname)s:%(lineno)s')
|
||||
|
||||
formatters = {
|
||||
'debug': {
|
||||
'()': olympia.core.logger.Formatter,
|
||||
'datefmt': '%H:%M:%S',
|
||||
'format': '%(asctime)s ' + base_fmt,
|
||||
},
|
||||
'error': {
|
||||
'()': olympia.core.logger.Formatter,
|
||||
'datefmt': '%H:%M:%S',
|
||||
'format': ('%s %s: [%%(USERNAME)s][%%(REMOTE_ADDR)s] %s'
|
||||
% (settings.HOSTNAME, settings.SYSLOG_TAG, error_fmt)),
|
||||
'format': ('%(asctime)s %(name)s:%(levelname)s %(message)s :'
|
||||
'%(pathname)s:%(lineno)s'),
|
||||
},
|
||||
'json': {
|
||||
'()': olympia.core.logger.JsonFormatter,
|
||||
'logger_name': settings.MOZLOG_NAME
|
||||
},
|
||||
'prod': {
|
||||
'()': olympia.core.logger.Formatter,
|
||||
'datefmt': '%H:%M:%S',
|
||||
'format': ('%s %s: [%%(USERNAME)s][%%(REMOTE_ADDR)s] %s'
|
||||
% (settings.HOSTNAME, settings.SYSLOG_TAG, base_fmt)),
|
||||
},
|
||||
'prod2': {
|
||||
'()': olympia.core.logger.Formatter,
|
||||
'datefmt': '%H:%M:%S',
|
||||
'format': ('%s %s: [%%(USERNAME)s][%%(REMOTE_ADDR)s] %s'
|
||||
% (settings.HOSTNAME, settings.SYSLOG_TAG2, base_fmt)),
|
||||
},
|
||||
}
|
||||
|
||||
handlers = {
|
||||
|
@ -59,16 +36,6 @@ handlers = {
|
|||
'level': 'ERROR',
|
||||
'class': 'django_statsd.loggers.errors.StatsdHandler',
|
||||
},
|
||||
'syslog': {
|
||||
'class': 'mozilla_logger.log.UnicodeHandler',
|
||||
'facility': logging.handlers.SysLogHandler.LOG_LOCAL7,
|
||||
'formatter': 'prod',
|
||||
},
|
||||
'syslog2': {
|
||||
'class': 'mozilla_logger.log.UnicodeHandler',
|
||||
'facility': logging.handlers.SysLogHandler.LOG_LOCAL7,
|
||||
'formatter': 'prod2',
|
||||
},
|
||||
}
|
||||
|
||||
loggers = {
|
||||
|
@ -125,8 +92,6 @@ def log_configure():
|
|||
else:
|
||||
cfg[key] = value
|
||||
|
||||
if settings.USE_SYSLOG:
|
||||
cfg['loggers']['z.timer'] = {'handlers': ['syslog2']}
|
||||
if settings.USE_MOZLOG:
|
||||
# MozLog Application Request Summary. This is the logger
|
||||
# DockerflowMiddleware uses on every request. We don't currently use
|
||||
|
@ -136,13 +101,11 @@ def log_configure():
|
|||
'handlers': ['mozlog'],
|
||||
'level': 'DEBUG',
|
||||
}
|
||||
# Enable syslog or mozlog handlers by default if the corresponding settings
|
||||
# Enable mozlog handlers by default if the corresponding settings
|
||||
# are set, otherwise default to the raw basic console.
|
||||
default_handlers = []
|
||||
if settings.USE_MOZLOG:
|
||||
default_handlers.append('mozlog')
|
||||
if settings.USE_SYSLOG:
|
||||
default_handlers.append('syslog')
|
||||
if not default_handlers:
|
||||
default_handlers = ['console']
|
||||
|
||||
|
|
|
@ -1306,11 +1306,8 @@ CELERY_TASK_SOFT_TIME_LIMIT = 60 * 30
|
|||
|
||||
# Logging
|
||||
LOG_LEVEL = logging.DEBUG
|
||||
USE_SYSLOG = True
|
||||
USE_MOZLOG = True
|
||||
SYSLOG_TAG = "http_app_addons"
|
||||
SYSLOG_TAG2 = "http_app_addons2"
|
||||
MOZLOG_NAME = SYSLOG_TAG
|
||||
MOZLOG_NAME = "http_app_addons"
|
||||
# See PEP 391 and log_settings_base.py for formatting help. Each section of
|
||||
# LOGGING will get merged into the corresponding section of
|
||||
# log_settings_base.py. Handlers and log levels are set up automatically based
|
||||
|
@ -1327,7 +1324,6 @@ LOGGING = {
|
|||
'rdflib': {'handlers': ['null']},
|
||||
'z.task': {'level': logging.INFO},
|
||||
'z.es': {'level': logging.INFO},
|
||||
'z.reviewers.auto_approve': {'handlers': ['syslog', 'console']},
|
||||
's.client': {'level': logging.INFO},
|
||||
},
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче