Skip to content

Commit

Permalink
log to stdout, instead of stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-mccarthy committed Dec 19, 2023
1 parent 9a30612 commit 7b642e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sdk/python/kfp/local/logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import contextlib
import datetime
import logging
import sys
from typing import Any, Dict, Generator, List

from kfp import dsl
Expand Down Expand Up @@ -52,7 +53,11 @@ def local_logger_context() -> Generator[None, None, None]:
fmt='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%H:%M:%S.%f',
)
handler = logging.StreamHandler()
# use sys.stdout so that both inner process and outer process logs
# go to stdout
# this is needed for logs to present sequentially in a colab notebook,
# since stderr will print above stdout
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(formatter)
logger.handlers.clear()
logger.addHandler(handler)
Expand Down

0 comments on commit 7b642e9

Please sign in to comment.