From ab04e38dc8cf99fe3b75ca21893d68dbc831de9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Mon, 28 Jul 2014 12:07:55 -0700 Subject: [PATCH 1/2] Reload logger config on SIGHUP Particularly useful for logrotate. --- radicale/log.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/radicale/log.py b/radicale/log.py index 7a49a4e..5ca336c 100644 --- a/radicale/log.py +++ b/radicale/log.py @@ -28,6 +28,7 @@ import os import sys import logging import logging.config +import signal from . import config @@ -35,6 +36,14 @@ from . import config LOGGER = logging.getLogger() +def configure_from_file(filename, debug): + logging.config.fileConfig(filename) + if debug: + LOGGER.setLevel(logging.DEBUG) + for handler in LOGGER.handlers: + handler.setLevel(logging.DEBUG) + + def start(): """Start the logging according to the configuration.""" filename = os.path.expanduser(config.get("logging", "config")) @@ -42,11 +51,11 @@ def start(): if os.path.exists(filename): # Configuration taken from file - logging.config.fileConfig(filename) - if debug: - LOGGER.setLevel(logging.DEBUG) - for handler in LOGGER.handlers: - handler.setLevel(logging.DEBUG) + configure_from_file(filename, debug) + # Reload config on SIGHUP + def handler(signum, frame): + configure_from_file(filename, debug) + signal.signal(signal.SIGHUP, handler) else: # Default configuration, standard output handler = logging.StreamHandler(sys.stdout) From 71c243035e169149f6448dc50b085c8781d39779 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Thu, 18 Sep 2014 14:21:10 +0200 Subject: [PATCH 2/2] Remove props file when deleting a collection with multifilesystem --- radicale/storage/multifilesystem.py | 1 + 1 file changed, 1 insertion(+) diff --git a/radicale/storage/multifilesystem.py b/radicale/storage/multifilesystem.py index ca2d70c..647d7e7 100644 --- a/radicale/storage/multifilesystem.py +++ b/radicale/storage/multifilesystem.py @@ -60,6 +60,7 @@ class Collection(filesystem.Collection): def delete(self): shutil.rmtree(self._path) + os.remove(self._props_path) def remove(self, name): if os.path.exists(os.path.join(self._path, name)):