https://flyte.org logo
#ask-the-community
Title
# ask-the-community
g

Greg Linklater

02/02/2024, 12:50 PM
Is there a convenient way of logging inside normal python tasks running on a remote cluster? Specifically just logging to
stdout
or somehow accessible on the Flyte web interface
Or rather I should ask why if I
print
something it does not appear in the output and how do I fix that?
Apparently
stderr
seems to work. Any idea why
stdout
won’t?
l

L godlike

02/02/2024, 2:13 PM
it should print in the pod log if you use
print
g

Greg Linklater

02/02/2024, 2:20 PM
Which is why I am confused that it is not…
l

L godlike

02/02/2024, 2:23 PM
let me clarify
if you use
print
you should be able to see the logs by kubectl
if you use logger
g

Greg Linklater

02/02/2024, 2:24 PM
Yes, which I am not able to unless I write to
stderr
l

L godlike

02/02/2024, 2:24 PM
the default version of flytekit is debug I guess, but you should change it to info by setting env
you can use logger and set the level to 20
g

Greg Linklater

02/02/2024, 2:25 PM
if you use logger
Which logger?
l

L godlike

02/02/2024, 2:25 PM
flytekit
has its own logger
finding example
g

Greg Linklater

02/02/2024, 2:27 PM
I’ve been searching this Slack and documentation for mention of some kind of logger and not coming up with anything… some kind of example or reference would be very appreciated!
l

L godlike

02/02/2024, 2:27 PM
ImageSpec(python_version="3.9.13", packages=[flytekit_package, flytekitplugins_spark_package], registry="localhost:30000", apt_packages=["git","wget"], env={"FLYTE_SDK_LOGGING_LEVEL": "20"},)
you can use imagespec, or add env to your dockerfile like this
you can print log by using this 2 lines
and remember to setup the env variable!
g

Greg Linklater

02/02/2024, 2:33 PM
Thanks that works as expected!
c

Chris Grass

02/02/2024, 2:53 PM
I agree with Greg that the documentation around this could be improved. it took me a while to figure out how to log flytekit code
s

Samhita Alla

02/05/2024, 5:53 AM
would you mind creating a docs issue? @Greg Linklater / @Chris Grass [flyte-docs]
s

Samhita Alla

02/05/2024, 5:53 AM
cc @Nikki Everett
n

Nikki Everett

02/05/2024, 3:36 PM
i didn't see an existing docs issue, so i went ahead and created one: https://github.com/flyteorg/flyte/issues/4830
9 Views