From b15a5c2c8796c343264063271aea23504aabd48a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 15 Mar 2024 17:50:01 +0100 Subject: [PATCH] Add full year and milliseconds to log timestamp (#4954) This synchronizes log timestamps with how Home Assistant Core formats them: Using the full 4 digit year and milliseconds precision. See also https://github.com/home-assistant/core/pull/74518. --- supervisor/bootstrap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/supervisor/bootstrap.py b/supervisor/bootstrap.py index bcb6ffb56..5e3dd2981 100644 --- a/supervisor/bootstrap.py +++ b/supervisor/bootstrap.py @@ -256,9 +256,11 @@ def migrate_system_env(coresys: CoreSys) -> None: def initialize_logging() -> None: """Initialize the logging.""" logging.basicConfig(level=logging.INFO) - fmt = "%(asctime)s %(levelname)s (%(threadName)s) [%(name)s] %(message)s" + fmt = ( + "%(asctime)s.%(msecs)03d %(levelname)s (%(threadName)s) [%(name)s] %(message)s" + ) colorfmt = f"%(log_color)s{fmt}%(reset)s" - datefmt = "%y-%m-%d %H:%M:%S" + datefmt = "%Y-%m-%d %H:%M:%S" # suppress overly verbose logs from libraries that aren't helpful logging.getLogger("aiohttp.access").setLevel(logging.WARNING)