0001-tests-disable-syslog-logging-handler-51267.patch
debian/debian_config_common.py | ||
---|---|---|
50 | 50 |
'%(levelname)s \x1f%(name)s \x1f%(message)s' |
51 | 51 |
) |
52 | 52 | |
53 |
DISABLE_GLOBAL_HANDLERS = os.environ.get('DISABLE_GLOBAL_HANDLERS') == '1' |
|
54 | ||
55 | ||
53 | 56 |
LOGGING = { |
54 | 57 |
'version': 1, |
55 | 58 |
'disable_existing_loggers': True, |
... | ... | |
175 | 178 |
}, |
176 | 179 |
# log py.warnings to syslog |
177 | 180 |
'py.warnings': { |
178 |
'handlers': ['syslog_no_filter'], |
|
181 |
'handlers': [] if DISABLE_GLOBAL_HANDLERS else ['syslog_no_filter'],
|
|
179 | 182 |
'level': 'WARNING', |
180 | 183 |
'propagate': False, |
181 | 184 |
}, |
182 | 185 |
'': { |
183 | 186 |
'level': 'DEBUG', |
184 | 187 |
'filters': ['request_context'], |
185 |
'handlers': ['syslog', 'mail_admins', 'debug'],
|
|
188 |
'handlers': ([] if DISABLE_GLOBAL_HANDLERS else ['syslog']) + ['mail_admins', 'debug'],
|
|
186 | 189 |
}, |
187 | 190 |
}, |
188 | 191 |
} |
189 | 192 | |
190 | 193 |
# Journald support |
191 |
if os.path.exists('/run/systemd/journal/socket'): |
|
194 |
if os.path.exists('/run/systemd/journal/socket') and not DISABLE_GLOBAL_HANDLERS:
|
|
192 | 195 |
try: |
193 | 196 |
from systemd import journal |
194 | 197 |
except ImportError: |
... | ... | |
203 | 206 |
LOGGING['loggers']['']['handlers'].remove('syslog') |
204 | 207 |
LOGGING['loggers']['']['handlers'].append('journald') |
205 | 208 | |
206 |
elif not os.path.exists('/dev/log'): |
|
209 |
elif not os.path.exists('/dev/log') and not DISABLE_GLOBAL_HANDLERS:
|
|
207 | 210 |
# if three's no syslog (for example when building a docker image), remove |
208 | 211 |
# those loggers. |
209 | 212 |
LOGGING['loggers']['']['handlers'].remove('syslog') |
tox.ini | ||
---|---|---|
9 | 9 |
[testenv] |
10 | 10 |
usedevelop = True |
11 | 11 |
setenv = |
12 |
DISABLE_GLOBAL_HANDLERS=1 |
|
12 | 13 |
BRANCH_NAME={env:BRANCH_NAME:} |
13 | 14 |
DB_ENGINE=django.db.backends.postgresql_psycopg2 |
14 | 15 |
SETUPTOOLS_USE_DISTUTILS=stdlib |
15 |
- |