-
What is the recommended route to enable Dagster to emit structured logs in Dagster+ by default? If you add a logger to the I've had a few discussions with Dagster team members who have mentioned there are some vague plans for improving this, but no one has been able to give me guidance on how exactly to set up custom loggers with the current Dagster implementation. Even if it's suboptimal, I'd really appreciate some guidance on how this is meant to be configured right now. There are multiple issues and discussions up right now with no actionable input from Dagster team members on how to solve this problem, non-standard logging feels very neglected right now. Of note, I'm using the ECS hybrid deployment right now. Willing to switch to k8s if it can get me custom logging, this is really killing a lot of plans I have to introduce much better visibility into our Dagster deployments and better tie Dagster logs to external compute logs and metrics. It sounds like any sort of first-class structured logging support is still a long ways out with no concrete plans in place right now, so even if someone can just provide a workaround while improvements are made that would be incredibly helpful. Unless of course it's just plain impossible right now, which would also be good to know so people don't spend tons of time on it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @zyd14 - firstly apologies for the bad experiences here. I'd like to see if we can fix the confusing To get a custom logger to be used by default in your Dagster+ jobs, you don't need to build a custom agent container. It's a little confusing because you specify it in the agent's dagster.yaml, but the configuration there is only read in your user code container so it should only need to be defined there. And you can use a custom formatter class - I sent out #24331 to see if we can make the Dagster-compatible JSON logging formatter that the
(or a different custom formatter class of your choosing). When I tried that, it added JSON formatted logs like this to the job output (in addition to the default system console logger for the jobs). One additional benefit of that approach (setting it in the dagster.yaml rather than in python code) is that it will still use that formatter for the initial events that happen before we have had a chance to load the job code yet. |
Beta Was this translation helpful? Give feedback.
Hi @zyd14 - firstly apologies for the bad experiences here. I'd like to see if we can fix the confusing
loggers
override behavior that you and many others have run into and sent out a PR to attempt to start that process here: #24338. I suspect the main blocker there is how to enable that behavior (which seems much more intuitive to me) without it being a breaking change for existing loggers.To get a custom logger to be used by default in your Dagster+ jobs, you don't need to build a custom agent container. It's a little confusing because you specify it in the agent's dagster.yaml, but the configuration there is only read in your user code container so it should only need to be defined th…