From 8d340e9d1ffef89377f0f446916b7e96d84fb43f Mon Sep 17 00:00:00 2001 From: Measrainsey Meng Date: Thu, 31 Oct 2024 14:14:28 +0100 Subject: [PATCH] Change logging from FileHandler() to StreamHandler() on stdout This allows for the logs to be output in the terminal, which is helpful when running CHILLED on UniCC. --- message_ix_buildings/chilled/util/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/message_ix_buildings/chilled/util/common.py b/message_ix_buildings/chilled/util/common.py index 4660f00..5d1e21d 100644 --- a/message_ix_buildings/chilled/util/common.py +++ b/message_ix_buildings/chilled/util/common.py @@ -1,4 +1,5 @@ import logging +import sys from pathlib import Path @@ -11,7 +12,7 @@ def get_logger(name: str): log.setLevel(logging.INFO) # configure the handler and formatter as needed - handler = logging.FileHandler(f"{name}.log", mode="w") + handler = logging.StreamHandler(sys.stdout) formatter = logging.Formatter("%(name)s %(asctime)s %(levelname)s %(message)s") # add formatter to the handler