https://prefect.io logo
d

Dolor Oculus

11/23/2020, 2:41 PM
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
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?
e

emre

11/23/2020, 3:27 PM
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

11/24/2020, 12:39 AM
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
e

emre

11/24/2020, 11:59 AM
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.
2 Views