Commit 4cc80b95 authored by Arnaud Fontaine's avatar Arnaud Fontaine

squash! zope4: Configure logging similarly to what ZConfig used to do.

parent b4c86906
...@@ -184,13 +184,19 @@ def runwsgi(): ...@@ -184,13 +184,19 @@ def runwsgi():
root_logger = logging.getLogger() root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO) root_logger.setLevel(logging.INFO)
event_log_handler = logging.FileHandler(args.event_log_file) if args.event_log_file is None:
event_log_handler = logging.StreamHandler(sys.stdout)
else:
event_log_handler = logging.FileHandler(args.event_log_file)
event_log_handler.setFormatter(logging.Formatter( event_log_handler.setFormatter(logging.Formatter(
"------\n%(asctime)s,%(msecs)d %(levelname)s %(name)s %(message)s", "------\n%(asctime)s,%(msecs)d %(levelname)s %(name)s %(message)s",
"%Y-%m-%d %H:%M:%S")) "%Y-%m-%d %H:%M:%S"))
root_logger.addHandler(event_log_handler) root_logger.addHandler(event_log_handler)
access_log_handler = logging.FileHandler(args.access_log_file) if args.access_log_file is None:
access_log_handler = logging.StreamHandler(sys.stdout)
else:
access_log_handler = logging.FileHandler(args.access_log_file)
access_log_handler.setLevel(logging.INFO) access_log_handler.setLevel(logging.INFO)
access_log_logger = logging.getLogger('access') access_log_logger = logging.getLogger('access')
access_log_logger.propagate = False access_log_logger.propagate = False
......
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