[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] import after logging is configured



commit 40c835ba1e0e2600ebde9fe36320d600ea15bdec
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Mon Sep 19 17:14:09 2011 -0700

    import after logging is configured
    
    bridgedb.Server tries to graciously import GeoIP support, but because
    logging is not yet configured at import time Python creates a default
    handler that goes to the console and ignores further basicConfig calls
    
    See also:
    http://stackoverflow.com/questions/1943747/ \
    python-logging-before-you-run-logging-basicconfig
    
    Our solution is to relocate the import so that configureLogging() is
    called first.
---
 lib/bridgedb/Main.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py
index 2ef56bf..3e06936 100644
--- a/lib/bridgedb/Main.py
+++ b/lib/bridgedb/Main.py
@@ -18,7 +18,6 @@ from twisted.internet import reactor
 import bridgedb.Bridges as Bridges
 import bridgedb.Dist as Dist
 import bridgedb.Time as Time
-import bridgedb.Server as Server
 import bridgedb.Storage
 import bridgedb.Opt as Opt
 import bridgedb.Bucket as Bucket
@@ -235,6 +234,11 @@ def startup(cfg):
     # Set up logging.
     configureLogging(cfg)
 
+    #XXX import Server after logging is set up
+    # Otherwise, python will create a default handler that logs to
+    # the console and ignore further basicConfig calls
+    import bridgedb.Server as Server
+
     # Load the master key, or create a new one.
     key = getKey(cfg.MASTER_KEY_FILE)
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits