Merge ~cjwatson/launchpad:gunicorn-tidy-logging into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: fe4006e917b70a717ca3476ba8e1753af9186f19
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:gunicorn-tidy-logging
Merge into: launchpad:master
Diff against target: 83 lines (+35/-7)
2 files modified
lib/lp/scripts/runlaunchpad.py (+8/-2)
lib/lp/scripts/tests/test_runlaunchpad.py (+27/-5)
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+404416@code.launchpad.net

Commit message

Tidy up gunicorn logging some more

Description of the change

If we're using gunicorn, we don't want the extra ZConfig log handler; all the logging should go to Talisker's structured logger.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/scripts/runlaunchpad.py b/lib/lp/scripts/runlaunchpad.py
2index 61be72e..2c8b232 100644
3--- a/lib/lp/scripts/runlaunchpad.py
4+++ b/lib/lp/scripts/runlaunchpad.py
5@@ -343,9 +343,15 @@ def gunicornify_zope_config_file():
6 content = fd.read()
7
8 # Remove unwanted tags.
9- for tag in ['server', 'accesslog']:
10+ for tag in ['server', 'accesslog', 'logger']:
11 content = re.sub(
12- r"<%s>(.*)</%s>" % (tag, tag), "", content, flags=re.S)
13+ r"<%s>.*?</%s>" % (tag, tag), "", content, flags=re.S)
14+
15+ # Remove unwanted contents of required tags.
16+ for tag in ['eventlog']:
17+ content = re.sub(
18+ r"<%s>.*?</%s>" % (tag, tag), "<%s>\n</%s>" % (tag, tag), content,
19+ flags=re.S)
20
21 # Remove unwanted single-line directives.
22 for directive in ['interrupt-check-interval']:
23diff --git a/lib/lp/scripts/tests/test_runlaunchpad.py b/lib/lp/scripts/tests/test_runlaunchpad.py
24index 27d2051..15dbc5d 100644
25--- a/lib/lp/scripts/tests/test_runlaunchpad.py
26+++ b/lib/lp/scripts/tests/test_runlaunchpad.py
27@@ -205,16 +205,32 @@ class TestAppServerStart(lp.testing.TestCase):
28 type XXX
29 address 123
30 </server>
31-
32+
33 <zodb>
34 <mappingstorage/>
35 </zodb>
36-
37+
38 <accesslog>
39 <logfile>
40 path logs/test-appserver-layer.log
41 </logfile>
42 </accesslog>
43+
44+ <eventlog>
45+ <logfile>
46+ path logs/test-appserver-layer.log
47+ </logfile>
48+ </eventlog>
49+
50+ <logger>
51+ name zc.tracelog
52+ propagate false
53+
54+ <logfile>
55+ format %(message)s
56+ path logs/test-appserver-layer-trace.log
57+ </logfile>
58+ </logger>
59 """)
60 config_filename = tempfile.mktemp()
61 with open(config_filename, "w") as fd:
62@@ -233,12 +249,18 @@ class TestAppServerStart(lp.testing.TestCase):
63 site-definition zcml/webapp.zcml
64 # With some comment
65 devmode off
66-
67-
68-
69+
70+
71+
72+
73 <zodb>
74 <mappingstorage/>
75 </zodb>
76
77
78+
79+ <eventlog>
80+ </eventlog>
81+
82+
83 """), new_file.read())

Subscribers

People subscribed via source and target branches

to status/vote changes: