When following the instructions for WSGI dispatch at 
https://kallithea.readthedocs.io/en/latest/setup.html#apache-with-mod-wsgi any 
attempt to pass defaults to the logging initialization fails later, when 
logging is initialized again in :func:`make_app` of 
|kallithea/config/middleware.py|.

See 
http://sw-amt.ws/kallithea-deploy/html/overview.html#bug-logging-re-initialized-in-make-app
 for a full description of the bug.

Attached is a patch, that works for me.

Wolfgang Scherer


diff --git a/kallithea/config/middleware.py b/kallithea/config/middleware.py
--- a/kallithea/config/middleware.py
+++ b/kallithea/config/middleware.py
@@ -13,6 +13,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """WSGI middleware initialization for the Kallithea application."""

+import os
 import logging.config

 from kallithea.config.app_cfg import base_config
@@ -49,5 +50,8 @@
     ``app_conf`` contains all the application-specific settings (those defined
     under ``[app:main]``.
     """
-    logging.config.fileConfig(global_conf['__file__'])
+    if len(logging.root.handlers) == 0:
+        _inifile = global_conf['__file__']
+        logging.config.fileConfig(_inifile, dict(
+            __file__=_inifile, here=os.path.dirname(_inifile)))
     return make_app_without_logging(global_conf, full_stack=full_stack, **app_conf)
_______________________________________________
kallithea-general mailing list
[email protected]
https://lists.sfconservancy.org/mailman/listinfo/kallithea-general

Reply via email to