Commit 240261bd authored by Chris McDonough's avatar Chris McDonough

Changes to support PEP 282-based logger instead of minimal logger.

parent c974fbd3
...@@ -95,6 +95,8 @@ def setup_signals(storages): ...@@ -95,6 +95,8 @@ def setup_signals(storages):
def main(argv): def main(argv):
me = argv[0] me = argv[0]
sys.path.insert(0, directory(me, 2)) sys.path.insert(0, directory(me, 2))
import zLOG
zLOG.initialize()
global LOG, INFO, ERROR global LOG, INFO, ERROR
from zLOG import LOG, INFO, WARNING, ERROR, PANIC from zLOG import LOG, INFO, WARNING, ERROR, PANIC
...@@ -203,7 +205,7 @@ def main(argv): ...@@ -203,7 +205,7 @@ def main(argv):
if args: if args:
if len(args) > 1: if len(args) > 1:
print usage print usage
print 'Unrecognizd arguments: ', " ".join(args[1:]) print 'Unrecognized arguments: ', " ".join(args[1:])
sys.exit(1) sys.exit(1)
fs = args[0] fs = args[0]
...@@ -211,6 +213,7 @@ def main(argv): ...@@ -211,6 +213,7 @@ def main(argv):
os.environ['Z_DEBUG_MODE'] = '1' os.environ['Z_DEBUG_MODE'] = '1'
if detailed: if detailed:
os.environ['STUPID_LOG_SEVERITY'] = '-300' os.environ['STUPID_LOG_SEVERITY'] = '-300'
zLOG.initialize()
set_uid(UID) set_uid(UID)
...@@ -308,17 +311,18 @@ def main(argv): ...@@ -308,17 +311,18 @@ def main(argv):
def rotate_logs(): def rotate_logs():
import zLOG import zLOG
# There hasn't been a clear way to reinitialize the MinimalLogger.
# I'll checkin the public initialize() method soon, but also try some
# other strategies for older Zope installs :-(.
init = getattr(zLOG, 'initialize', None) init = getattr(zLOG, 'initialize', None)
if init is not None: if init is not None:
init() init()
return return
# This will work if the minimal logger is in use, but not if some # This will work if the minimal logger is in use, but not if some
# other logger is active. # other logger is active. MinimalLogger exists only in Zopes
# pre-2.7.
try:
import zLOG.MinimalLogger import zLOG.MinimalLogger
zLOG.MinimalLogger._log.initialize() zLOG.MinimalLogger._log.initialize()
except ImportError:
pass
def rotate_logs_handler(signum, frame): def rotate_logs_handler(signum, frame):
rotate_logs() rotate_logs()
......
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