Commit b0217ac0 authored by Guido van Rossum's avatar Guido van Rossum

Add zLOG configuration through a <Log> section in the <Host> section.

XXX This will probably go away once we decide how we really want to do
this.
parent f80a5e0b
......@@ -149,6 +149,7 @@ class ZEOOptions(Options):
hostname = None # A subclass may set this
hostconf = None # <Host> section
zeoconf = None # <ZEO> section
logconf = None # <Log> section
family = None # set by -a; AF_UNIX or AF_INET
address = None # set by -a; string or (host, port)
......@@ -213,9 +214,11 @@ class ZEOOptions(Options):
if self.zeoconf is None:
# If no <ZEO> section exists, fall back to the host (or root)
self.zeoconf = self.hostconf
self.logconf = self.hostconf.getSection("Log")
# Now extract options from various configuration sections
self.load_zeoconf()
self.load_logconf()
self.load_storages()
def load_zeoconf(self):
......@@ -237,6 +240,28 @@ class ZEOOptions(Options):
self.family = socket.AF_UNIX
self.address = path
def load_logconf(self):
# Get logging options from conf, unless overridden by environment
if not self.logconf:
return
reinit = 0
if os.getenv("EVENT_LOG_FILE") is None:
if os.getenv("STUPID_LOG_FILE") is None:
path = self.logconf.get("path")
if path is not None:
os.environ["EVENT_LOG_FILE"] = path
os.environ["STUPID_LOG_FILE"] = path
reinit = 1
if os.getenv("EVENT_LOG_SEVERITY") is None:
if os.getenv("STUPID_LOG_SEVERITY") is None:
level = self.logconf.get("level")
if level is not None:
os.environ["EVENT_LOG_SEVERITY"] = level
os.environ["STUPID_LOG_SEVERITY"] = level
reinit = 1
if reinit:
zLOG.initialize()
def load_storages(self):
# Get the storage specifications
if self.storages:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment