Is there a way to dynamically control prefect’s lo...
# ask-community
i
Is there a way to dynamically control prefect’s logging level? References in the docs stipulate using environment variables and/or logging file, but these are read before a deployment is run, so changing them within Python has no effect. Effectively I’d like to silence “Submitted task run…” and “Created task run…”
1
b
Hey Idan, in regard to supressing certian logging messages, this discourse post may help you out with that.
i
Hey @Bianca Hoch, I of course reached that page. It specifies a variety of ways to disable logging if you have access to the server. This is about cancelling specific loggers from within the deployment…
b
Hmm. AFAIK, if you'd like to control the logging level, or filter certain types of logs, you'll need to have access to a custom logging.yml which has your desired logging config.
Maybe you could create a custom logging.yaml and store it in the same directory as your flow, and reference the path to it using the
PREFECT_LOGGING_SETTINGS_PATH
variable?
^This environment variable could be set within the deployment