[dagster pipes] How do i get log messages in the external process to output in stdout / stderr? #19203
Answered
by
alangenfeld
alangenfeld
asked this question in
Q&A
-
When using |
Beta Was this translation helpful? Give feedback.
Answered by
alangenfeld
Jan 12, 2024
Replies: 1 comment 1 reply
-
The import sys
import logging
with open_dagster_pipes(
...
) as pipes:
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(levelname)s - %(message)s')
handler.setFormatter(formatter)
pipes.log.addHandler(handler)
pipes.log.info(f"Run ID: {pipes.run_id}") |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alangenfeld
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
log
property onPipesContext
is alogging.Logger
so you can add your own handler like so: