From d4fda3e72edde3d37de16d6324c7df9fe9f3cca2 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Sep 23 2019 13:31:18 +0000 Subject: backend: once more redis logger + exceptions The RedisPublishHandler expands 'logrecord.msg % logrecord.args', but we use 'log.exception(ex)' idiom on many places in backend code - and the '%' operator doesn't convert the left operand automatically. --- diff --git a/backend/backend/helpers.py b/backend/backend/helpers.py index 451fb50..096d276 100644 --- a/backend/backend/helpers.py +++ b/backend/backend/helpers.py @@ -393,6 +393,10 @@ class RedisPublishHandler(logging.Handler): # copr specific semantics record.who = self.who + # First argument to 'log.exception()' should be 'str' type. If it is + # not, we need to convert it before using '%' operator below. + record.msg = str(record.msg) + # For the message arguments, it is better to expand them right now # instead of relying on method in json.dumps(..., default=default) # and even worse rely on it's reverse action in RedisLogHandler.