Merge lp:~allenap/maas/lies-damn-lies-and-logging into lp:~maas-committers/maas/trunk

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 3817
Proposed branch: lp:~allenap/maas/lies-damn-lies-and-logging
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 90 lines (+16/-23)
4 files modified
contrib/maas-rsyslog.conf (+1/-1)
src/maas/settings.py (+10/-20)
src/provisioningserver/logger/log.py (+4/-1)
src/provisioningserver/tests/test_tags.py (+1/-1)
To merge this branch: bzr merge lp:~allenap/maas/lies-damn-lies-and-logging
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+247013@code.launchpad.net

Commit message

Filter syslog tags for 'maas' more carefully, don't clobber the 'maas' logger, and don't propagate messages from the 'maas' logger.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (88.8 KiB)

The attempt to merge lp:~allenap/maas/lies-damn-lies-and-logging into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [78.5 kB]
Get:6 http://security.ubuntu.com trusty-security/universe Sources [19.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [258 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [92.5 kB]
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [192 kB]
Get:10 http://security.ubuntu.com trusty-security/main Translation-en [131 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [108 kB]
Get:12 http://security.ubuntu.com trusty-security/universe Translation-en [51.4 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [497 kB]
Get:14 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [263 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,820 kB in 3s (557 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-iscpy python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr py...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'contrib/maas-rsyslog.conf'
2--- contrib/maas-rsyslog.conf 2014-07-29 10:38:32 +0000
3+++ contrib/maas-rsyslog.conf 2015-04-14 14:38:55 +0000
4@@ -1,2 +1,2 @@
5 # Log MAAS messages to their own file.
6-:syslogtag,contains,"maas" /var/log/maas/maas.log
7+:syslogtag,regex,"^maas\b$" /var/log/maas/maas.log
8
9=== modified file 'src/maas/settings.py'
10--- src/maas/settings.py 2015-03-30 08:26:36 +0000
11+++ src/maas/settings.py 2015-04-14 14:38:55 +0000
12@@ -260,8 +260,13 @@
13 'django.contrib.admin',
14 )
15
16-# See http://docs.djangoproject.com/en/dev/topics/logging for
17-# more details on how to customize the logging configuration.
18+# See http://docs.djangoproject.com/en/dev/topics/logging for more details on
19+# how to customize the logging configuration.
20+#
21+# NOTE CAREFULLY that django.utils.log.DEFAULT_LOGGING is applied *before*
22+# applying the configuration below. This means that you need to mentally
23+# combine the settings in both DEFAULT_LOGGING and LOGGING to understand the
24+# resultant behaviour.
25 LOGGING = {
26 'version': 1,
27 'disable_existing_loggers': False,
28@@ -280,26 +285,11 @@
29 },
30 'root': {
31 'handlers': ['stdout'],
32+ 'level': DEFAULT_LOG_LEVEL,
33 },
34+ # Do *not* set any options for the `maas` logger here because config done
35+ # elsewhere -- by configure_root_logger() -- will be clobbered.
36 'loggers': {
37- 'maas': {
38- 'level': DEFAULT_LOG_LEVEL,
39- },
40- 'maasserver': {
41- 'level': DEFAULT_LOG_LEVEL,
42- },
43- 'metadataserver': {
44- 'level': DEFAULT_LOG_LEVEL,
45- },
46- 'django.request': {
47- 'level': DEFAULT_LOG_LEVEL,
48- },
49- 'django.db.backends': {
50- 'level': DEFAULT_LOG_LEVEL,
51- },
52- 'sstreams': {
53- 'level': DEFAULT_LOG_LEVEL,
54- },
55 'urllib3': {
56 'level': 'WARN',
57 },
58
59=== modified file 'src/provisioningserver/logger/log.py'
60--- src/provisioningserver/logger/log.py 2015-03-04 23:52:02 +0000
61+++ src/provisioningserver/logger/log.py 2015-04-14 14:38:55 +0000
62@@ -60,11 +60,14 @@
63 root = get_maas_logger()
64 if len(root.handlers) == 0:
65 # It has not yet been configured.
66- handler = SysLogHandler("/dev/log")
67+ handler = SysLogHandler(
68+ "/dev/log", facility=SysLogHandler.LOG_DAEMON)
69 handler.setFormatter(logging.Formatter(
70 "%(name)s: [%(levelname)s] %(message)s"))
71 root.addHandler(handler)
72 root.setLevel(logging.INFO)
73+ # Don't propagate logs up to the root logger.
74+ root.propagate = 0
75 return root
76
77
78
79=== modified file 'src/provisioningserver/tests/test_tags.py'
80--- src/provisioningserver/tests/test_tags.py 2015-03-25 15:33:23 +0000
81+++ src/provisioningserver/tests/test_tags.py 2015-04-14 14:38:55 +0000
82@@ -106,7 +106,7 @@
83
84 def setUp(self):
85 super(TestMergeDetailsCleanly, self).setUp()
86- self.logger = self.useFixture(FakeLogger())
87+ self.logger = self.useFixture(FakeLogger("maas"))
88
89 def test_merge_with_no_details(self):
90 xml = self.do_merge_details({})