← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:remove-thread-request-debug into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:remove-thread-request-debug into launchpad:master.

Commit message:
Remove per-thread request debugging to filesystem

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/429455

This was added in 2006, but it hasn't been something we've used at all recently, and it's mostly superseded by Talisker logging.  Writing logs into the code tree is problematic for charmed deployments, so I'd prefer to avoid it.

If we need to bring this back for some reason, it should be behind a configuration option that's only enabled for development.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-thread-request-debug into launchpad:master.
diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py
index 2fd5543..2e5332d 100644
--- a/lib/lp/services/webapp/publication.py
+++ b/lib/lp/services/webapp/publication.py
@@ -10,7 +10,6 @@ import re
 import sys
 import threading
 import time
-import traceback
 from urllib.parse import quote
 
 import transaction
@@ -53,7 +52,6 @@ from lp.services.database.interfaces import (
 from lp.services.database.policy import LaunchpadDatabasePolicy
 from lp.services.features.flags import NullFeatureController
 from lp.services.oauth.interfaces import IOAuthSignedRequest
-from lp.services.osutils import open_for_writing
 from lp.services.statsd.interfaces.statsd_client import IStatsdClient
 from lp.services.webapp.interfaces import (
     FinishReadOnlyRequestEvent,
@@ -239,20 +237,6 @@ class LaunchpadBrowserPublication(
         notify(StartRequestEvent(request))
         request._traversal_start = time.time()
         request._traversal_thread_start = _get_thread_time()
-        threadid = threading.current_thread().ident
-        threadrequestfile = open_for_writing(
-            "logs/thread-%s.request" % threadid, "wb"
-        )
-        try:
-            request_txt = str(request)
-        except Exception:
-            request_txt = "Exception converting request to string\n\n"
-            try:
-                request_txt += traceback.format_exc()
-            except Exception:
-                request_txt += "Unable to render traceback!"
-        threadrequestfile.write(request_txt.encode("UTF-8"))
-        threadrequestfile.close()
         self.initializeLoggingContext(request)
 
         # Tell our custom database adapter that the request has started.