changeset 1175:d0f86d9a9d40

wsgi: Better logging for the admin app.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 21 May 2020 21:55:41 -0700
parents 3acfaf2e27f1
children 28c388fc18b2
files piecrust/wsgiutil/__init__.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/wsgiutil/__init__.py	Fri Oct 04 11:48:18 2019 -0700
+++ b/piecrust/wsgiutil/__init__.py	Thu May 21 21:55:41 2020 -0700
@@ -4,10 +4,13 @@
 
 def _setup_logging(log_file, log_level, max_log_bytes, log_backup_count):
     if log_file:
+        from logging import Formatter
         from logging.handlers import RotatingFileHandler
         handler = RotatingFileHandler(log_file, maxBytes=max_log_bytes,
                                       backupCount=log_backup_count)
         handler.setLevel(log_level)
+        handler.setFormatter(Formatter(
+            fmt='%(asctime)s %(levelname)s %(name)s: %(message)s'))
         logging.getLogger().addHandler(handler)