d

    Dolor Oculus

    1 year ago
    I'm registering a flow on a locally hosted server and would like the extra loggers functionality to be in effect when the scheduled flow runs. It looks like setting the environment variable `
    PREFECT__LOGGING__EXTRA_LOGGERS
    as per https://docs.prefect.io/core/concepts/logging.html#extra-loggers during flow registration isn't sufficient -- I'm not seeing my apps
    logging
    statements in the web ui. Is there a way to get this env variable setting to be in effect for when the app runs?
    emre

    emre

    1 year ago
    Hello, Environment variables need to be present on the environment running the flow, the environment where the registration happens doesn’t matter in terms of envvars. Easiest way to pass envvars to flows that will be run by an agent, is to use the
    --env
    option on the agent. The agent will provide
    --env
    options as environment variables to the flows runtime. For instance:
    prefect agent start --env "PREFECT__LOGGING__EXTRA_LOGGERS=BAR" local
    d

    Dolor Oculus

    1 year ago
    hi -- thank you! This is a little weird in that the agent is now aware of the
    BAR
    package name, which couples code used by the jobs being registered with it, but as a tactical solution it works 🙂 Cheers
    emre

    emre

    1 year ago
    Yeah, I don’t prefer using agents for environment variable setting either. It works as an easy solution, or maybe for settings that need to be applied to all flows from that agent. My personal preference is to just define env vars in a docker image. Works well since we exclusively use docker storage for production.