summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-10-30 01:21:33 +0000
committerMark Haines <mark.haines@matrix.org>2014-10-30 01:21:33 +0000
commitb29517bd013b82302b1a73072da8bfc39564dc1a (patch)
tree363ac928a18f2432b6d53c27dde2f2efb34b16a8 /synapse/app
parentfix mobile CSS layout (diff)
downloadsynapse-b29517bd013b82302b1a73072da8bfc39564dc1a.tar.xz
Add a request-id to each log line
Diffstat (limited to 'synapse/app')
-rwxr-xr-xsynapse/app/homeserver.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 6394bc27d1..4e74f4d14c 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -33,6 +33,7 @@ from synapse.api.urls import (
 )
 from synapse.config.homeserver import HomeServerConfig
 from synapse.crypto import context_factory
+from synapse.util.logcontext import LoggingContext
 
 from daemonize import Daemonize
 import twisted.manhole.telnet
@@ -240,7 +241,7 @@ def setup():
         daemon = Daemonize(
             app="synapse-homeserver",
             pid=config.pid_file,
-            action=reactor.run,
+            action=run,
             auto_close_fds=False,
             verbose=True,
             logger=logger,
@@ -250,6 +251,13 @@ def setup():
     else:
         reactor.run()
 
+def run():
+    with LoggingContext("run") as context:
+        reactor.run()
+
+def main():
+    with LoggingContext("main") as context:
+        setup()
 
 if __name__ == '__main__':
-    setup()
+    main()