Is there a convenient way of logging inside normal...
# flyte-support
s
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?
d
it should print in the pod log if you use
print
s
Which is why I am confused that it is not…
d
let me clarify
if you use
print
you should be able to see the logs by kubectl
if you use logger
s
Yes, which I am not able to unless I write to
stderr
d
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
s
if you use logger
Which logger?
d
flytekit
has its own logger
finding example
🙏 1
s
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!
d
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!
s
Thanks that works as expected!
🙏 1
p
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
👍 1
t
would you mind creating a docs issue? @sparse-pizza-79993 / @proud-answer-87162 [flyte-docs]
t
cc @white-chef-57887
👀 1
w
i didn't see an existing docs issue, so i went ahead and created one: https://github.com/flyteorg/flyte/issues/4830
👍 3