Is it possible to see the output of print statemen...
# dagster-plus
a
Is it possible to see the output of print statements from the dagster code that has been deployed to Dagster Cloud via k8s agent?
z
You may be interested in reading about dagster logging. Additionally, most contexts will have their own ready to use logger built in. Its quite convenient. EG:
Copy code
@asset
def my_asset(context):
    <http://context.log.info|context.log.info>("Hello")
    ...
a
Thanks @Zach P. I am not able to see even these context logs anywhere. The code gets deployed but there's an error so the code location doesn't get added. I am deploying it via GKE and there are no logs on the k8s side too..
z
Ahhh, are you able to deploy it locally? (EG: Running dagit /
dagster dev
)?
a
yes locally it's all good.. I think I can even fix the error I'm getting but I was just curious if I will have access to logs on GKE and Dagster Cloud
z
May be worth crossposting to #dagster-kubernetes . Does the error not appear in the deployment panel? I’m running dagster-cloud so it may be a bit different.
d
for now if you want to see process output while your code is being loaded, you'll need to look at the raw pod logs in kubernetes (there should be a pod with the name of your code location in it). We're working on getting those logs exposed in Dagit as well though. Logs from within your runs can be displayed in Dagit using the tools that Zach linked to
a
I was running the kubectl logs command but it only shows that dagster server is up.. no logs..
d
Is it possible to share your code that isn't logging the way you expect it to, or a code snippet that reproduces the problem?
If I add a print statement in the module being loaded, I see it in the grpc server output: (I added a print("HELLO")
Copy code
HELLO
2023-02-22 20:18:47 -0600 - dagster - INFO - Started Dagster code server for module dagster_test.toys.repo on port 4000 in process 12784
a
hmm yeah that's how it works on local.. okay I will check again.. this was super helpful!