From 38dea33fe9a5e6bef39566295cc8d05fb1d88223 Mon Sep 17 00:00:00 2001 From: melanie witt Date: Thu, 1 Aug 2024 23:41:43 +0000 Subject: [PATCH] oslo.log: Configure log color by $LOG_COLOR Relatively recently oslo.log 6.1.0 was released and contains change I7966d4f4977b267f620946de4a5509f53b043652 which added an option to enable color in logs which defaults to False. This caused a change in behavior for DevStack such that viewing logs with journalctl no longer showed different colors for different log levels, which can make debugging more difficult when developing with DevStack. This adds olso.log color configuration based on the existing $LOG_COLOR DevStack variable for log color which defaults to True for interactive invocations. Change-Id: If10aada573eb4360e81585d4fb7e5d97f15bc52b --- functions | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions b/functions index f81e8f0a08..42d08d7c4a 100644 --- a/functions +++ b/functions @@ -694,6 +694,8 @@ function setup_colorized_logging { iniset $conf_file DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s" iniset $conf_file DEFAULT logging_debug_format_suffix "from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d" iniset $conf_file DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s %(instance)s" + # Enable or disable color for oslo.log + iniset $conf_file DEFAULT log_color $LOG_COLOR } function setup_systemd_logging { @@ -715,6 +717,9 @@ function setup_systemd_logging { iniset $conf_file DEFAULT logging_context_format_string "%(color)s%(levelname)s %(name)s [%(global_request_id)s %(request_id)s %(project_name)s %(user_name)s%(color)s] %(instance)s%(color)s%(message)s" iniset $conf_file DEFAULT logging_default_format_string "%(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s" iniset $conf_file DEFAULT logging_exception_prefix "ERROR %(name)s %(instance)s" + + # Enable or disable color for oslo.log + iniset $conf_file DEFAULT log_color $LOG_COLOR } function setup_standard_logging_identity {