From 8eaf4149b1f9a9bf56fda7dbe41049f25d35334a Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Sat, 21 Sep 2024 22:07:22 +0200 Subject: Enhance logging format for better readability Added timestamp with milliseconds, log level, and custom date format to improve clarity and make logs more useful for debugging. Change-Id: Ice2d601eddb54bbb0e7e3be6f03ba6db58256c1f --- docker/base/set_configs.py | 6 +++++- .../notes/kolla-container-logformat-259885637cbeb0e6.yaml | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/kolla-container-logformat-259885637cbeb0e6.yaml diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 82e2e4589..bd2747536 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -26,7 +26,11 @@ import sys # TODO(rhallisey): add docstring. -logging.basicConfig() +logging.basicConfig( + format='%(asctime)s.%(msecs)03d %(levelname)s %(message)s', + level=logging.INFO, + datefmt='%Y-%m-%d %H:%M:%S' +) LOG = logging.getLogger(__name__) LOG.setLevel(logging.INFO) diff --git a/releasenotes/notes/kolla-container-logformat-259885637cbeb0e6.yaml b/releasenotes/notes/kolla-container-logformat-259885637cbeb0e6.yaml new file mode 100644 index 000000000..c8056184b --- /dev/null +++ b/releasenotes/notes/kolla-container-logformat-259885637cbeb0e6.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + Improves logging format of kolla containers by adding + timestamps with milliseconds, log levels, and a custom + date format. +upgrade: + - | + Users who parse Docker container logs should take into account + that for example `INFO:__main__:Validating config file` is now + `YYYY-MM-DD HH:MM:SS.fff INFO Validating config file`. -- cgit v1.2.3