From 26e58cee56639d56aa1e90ca4623e60350eae009 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 3 Sep 2016 10:18:07 +0200 Subject: [PATCH 1/2] Use hexadecimal for thread Old: ... - 139891659843328 - INFO: Starting Radicale New: ... - [7f3b10b12700] INFO: Starting Radicale --- logging | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging b/logging index 5943118..a3b99f1 100644 --- a/logging +++ b/logging @@ -57,4 +57,4 @@ format = %(message)s [formatter_full] # Full output format -format = %(asctime)s - %(thread)d - %(levelname)s: %(message)s +format = %(asctime)s - [%(thread)x] %(levelname)s: %(message)s From d371179487c37017de3c79c155a7f235fb3f964b Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 3 Sep 2016 10:19:29 +0200 Subject: [PATCH 2/2] thread and level in simple log formatter The log messages are a mess without any allocation to threads. --- logging | 2 +- radicale/log.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/logging b/logging index a3b99f1..250359c 100644 --- a/logging +++ b/logging @@ -53,7 +53,7 @@ formatter = full [formatter_simple] # Simple output format -format = %(message)s +format = [%(thread)x] %(levelname)s: %(message)s [formatter_full] # Full output format diff --git a/radicale/log.py b/radicale/log.py index 34d4e4c..f550b48 100644 --- a/radicale/log.py +++ b/radicale/log.py @@ -56,7 +56,8 @@ def start(name="radicale", filename=None, debug=False): "Logging configuration file '%s' not found, using stderr." % filename) handler = logging.StreamHandler(sys.stderr) - handler.setFormatter(logging.Formatter("%(message)s")) + handler.setFormatter( + logging.Formatter("[%(thread)x] %(levelname)s: %(message)s")) logger.addHandler(handler) if debug: logger.setLevel(logging.DEBUG)