0001-tests-disable-syslog-logging-handler-51267.patch
debian/debian_config_common.py | ||
---|---|---|
52 | 52 |
'%(levelname)s \x1f%(name)s \x1f%(message)s' |
53 | 53 |
) |
54 | 54 | |
55 |
DISABLE_GLOBAL_HANDLERS = os.environ['DISABLE_GLOBAL_HANDLERS'] == 1 |
|
56 | ||
55 | 57 |
LOGGING = { |
56 | 58 |
'version': 1, |
57 | 59 |
'disable_existing_loggers': True, |
... | ... | |
177 | 179 |
}, |
178 | 180 |
# log py.warnings to syslog |
179 | 181 |
'py.warnings': { |
180 |
'handlers': ['syslog_no_filter'], |
|
182 |
'handlers': [] if DISABLE_GLOBAL_HANDLERS else ['syslog_no_filter'],
|
|
181 | 183 |
'level': 'WARNING', |
182 | 184 |
'propagate': False, |
183 | 185 |
}, |
184 | 186 |
'': { |
185 | 187 |
'level': 'DEBUG', |
186 | 188 |
'filters': ['request_context'], |
187 |
'handlers': ['syslog', 'mail_admins', 'debug'],
|
|
189 |
'handlers': ([] if DISABLE_GLOBAL_HANDLERS else ['syslog']) + ['mail_admins', 'debug'],
|
|
188 | 190 |
}, |
189 | 191 |
}, |
190 | 192 |
} |
191 | 193 | |
192 | 194 |
# Journald support |
193 |
if os.path.exists('/run/systemd/journal/socket'): |
|
195 |
if os.path.exists('/run/systemd/journal/socket') and not DISABLE_GLOBAL_HANDLERS:
|
|
194 | 196 |
try: |
195 | 197 |
from systemd import journal |
196 | 198 |
except ImportError: |
... | ... | |
205 | 207 |
LOGGING['loggers']['']['handlers'].remove('syslog') |
206 | 208 |
LOGGING['loggers']['']['handlers'].append('journald') |
207 | 209 | |
208 |
elif not os.path.exists('/dev/log'): |
|
210 |
elif not os.path.exists('/dev/log') and not DISABLE_GLOBAL_HANDLERS:
|
|
209 | 211 |
# if three's no syslog (for example when building a docker image), remove |
210 | 212 |
# those loggers. |
211 | 213 |
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 |
- |