I'm registering a flow on a locally hosted server ...
# prefect-community
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 `
Copy code
as per https://docs.prefect.io/core/concepts/logging.html#extra-loggers during flow registration isn't sufficient -- I'm not seeing my apps
statements in the web ui. Is there a way to get this env variable setting to be in effect for when the app runs?
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
option on the agent. The agent will provide
options as environment variables to the flows runtime. For instance:
prefect agent start --env "PREFECT__LOGGING__EXTRA_LOGGERS=BAR" local
hi -- thank you! This is a little weird in that the agent is now aware of the
package name, which couples code used by the jobs being registered with it, but as a tactical solution it works 🙂 Cheers
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.