Skip to content

Commit 88ee93e

Browse files
authored
Use default logger if fail to initialize RichHandler (#2423)
Signed-off-by: Kevin Su <pingsutw@apache.org>
1 parent f8355b3 commit 88ee93e

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

flytekit/loggers.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ def initialize_global_loggers():
8383
"""
8484
Initializes the global loggers to the default configuration.
8585
"""
86-
# Use Rich logging while running in the local execution
87-
if os.environ.get("FLYTE_INTERNAL_EXECUTION_ID", None) is None:
88-
upgrade_to_rich_logging()
89-
return
90-
9186
handler = logging.StreamHandler()
9287
handler.setLevel(logging.DEBUG)
9388
formatter = logging.Formatter(fmt="[%(name)s] %(message)s")
@@ -98,6 +93,10 @@ def initialize_global_loggers():
9893
set_flytekit_log_properties(handler, None, _get_env_logging_level())
9994
set_user_logger_properties(handler, None, logging.INFO)
10095

96+
# Use Rich logging while running in the local execution
97+
if os.environ.get("FLYTE_INTERNAL_EXECUTION_ID", None) is None or interactive.ipython_check():
98+
upgrade_to_rich_logging()
99+
101100

102101
def is_rich_logging_enabled() -> bool:
103102
return os.environ.get(LOGGING_RICH_FMT_ENV_VAR) != "0"
@@ -146,8 +145,5 @@ def get_level_from_cli_verbosity(verbosity: int) -> int:
146145
return logging.DEBUG
147146

148147

149-
if interactive.ipython_check():
150-
upgrade_to_rich_logging()
151-
else:
152-
# Default initialization
153-
initialize_global_loggers()
148+
# Default initialization
149+
initialize_global_loggers()

0 commit comments

Comments
 (0)