diff --git a/cms/log.py b/cms/log.py index b8c47b64ef..367ad1ebbc 100644 --- a/cms/log.py +++ b/cms/log.py @@ -393,16 +393,16 @@ def process(self, msg: str, kwargs: dict): # Install a shell handler. -shell_handler = StreamHandler(sys.stdout) +shell_handler = StreamHandler(sys.stderr) shell_handler.setLevel(logging.INFO) -shell_handler.setFormatter(CustomFormatter(has_color_support(sys.stdout))) +shell_handler.setFormatter(CustomFormatter(has_color_support(sys.stderr))) root_logger.addHandler(shell_handler) def set_detailed_logs(detailed: bool): """Set or unset the shell logs to detailed.""" global shell_handler - color = has_color_support(sys.stdout) + color = has_color_support(sys.stderr) formatter = DetailedFormatter(color) \ if detailed else CustomFormatter(color) shell_handler.setFormatter(formatter) diff --git a/cmsranking/Logger.py b/cmsranking/Logger.py index c5889d34e4..5675cc46fc 100644 --- a/cmsranking/Logger.py +++ b/cmsranking/Logger.py @@ -243,9 +243,9 @@ def format(self, record): root_logger.setLevel(logging.DEBUG) # Define the stream handler to output on stderr. -shell_handler = StreamHandler(sys.stdout) +shell_handler = StreamHandler(sys.stderr) shell_handler.setLevel(logging.INFO) -shell_handler.setFormatter(CustomFormatter(has_color_support(sys.stdout))) +shell_handler.setFormatter(CustomFormatter(has_color_support(sys.stderr))) root_logger.addHandler(shell_handler)