What is the most idiomatic way to change the defau...
# integration-dbt
d
What is the most idiomatic way to change the default event logger for dbt assets in a self-deployed setup? E.g., I can do:
Copy code
from dagster import Definitions, json_console_logger
from dbt_assets_resources import my_dbt_assets, my_dbt_resource

defs = Definitions(
    assets=[my_dbt_assets],
    resources={
        "dbt_resource": my_dbt_resource,
    },
    loggers={
      "console": json_console_logger
    }
)
And then in the UI launchpad I can configure
Copy code
loggers:
  console:
    config:
      log_level: INFO
      name: dbt_logs
However, what if I would like to use it as the default instead of configuring it manually in the UI?
🤖 1
r
The documentation for this is here: https://docs.dagster.io/concepts/logging/loggers#specifying-default-code-location-loggers Looks like you’ll have to define a job for your assets, and that will have the overridden logger.
d
yup, I checked the docs, and I am aware of
define_asset_job
, but in my understanding thereby I would loose the declarative auto-materialized scheduling of the individual dbt assets. From the docs:
Asset jobs materialize a fixed set of assets each time they run
My understanding is that dbt asset jobs are created automatically in the background, and
context
knows how to log, so what would be needed is a way to let the context of the dbt assets know which logger to use. (Or a way to set a global logger that all assets would honor.)
r
This is a better question for @owen if you’re using declarative scheduling!
o
Ah in this case, I think the simple fix would be to do
Copy code
defs = Definitions(
    assets=[my_dbt_assets],
    resources={
        "dbt_resource": my_dbt_resource,
    },
    loggers={
      "console": json_console_logger.configured(
          {"log_level": "INFO", "name": "dbt_logs"}
      )
    }
)
this will allow that configuration to be used for all jobs by default
d
Indeed, that would be a nice and dagster-ish solution. However, currently (v1.4.5) it does not work as the configuration is not honored. Or shall I pass it as a configuration to dagster-webserver and dagster-daemon, too?
o
ah I see -- this looks like a bug (the default loggers are not respected on the base asset jobs that are constructed in this function). Would you mind filing an issue for that behavior? I'm not aware of any workaround without a code change, although the fix should be fairly straightforward (just piping an argument through a few more functions)
d
OK, I will try to create a PR soon.