Hi Prefect Folks - Is it possible to adjust the lo...
# prefect-community
b
Hi Prefect Folks - Is it possible to adjust the log level of a running flow? 🧵
Normally
INFO
is fine for our use case, but we have seen on occasion something goes wrong and the job pod consumes all the free memory on the kubernetes node and we would like to capture additional logs when we’ve detected abnormal memory usage.
k
Yes, with
Copy code
prefect config set PREFECT_LOGGING_LEVEL="DEBUG"
b
Sorry, I should have stated I am on prefect 1.0.
In my testing it seemed like once a flow was running changing the log level didn’t have any impact.
k
b
I attempted to set the environment variable as well as via python setting the global log level to debug.
Copy code
>>> import prefect
>>> logger = prefect.context.get("logger")
>>> logger.getEffectiveLevel()
20
>>> logger.setLevel("DEBUG")
>>> logger.getEffectiveLevel()
10
I have this code in my flow:
Copy code
@task()
def log_debug():
    for i in range(10):
        logger = prefect.context.get("logger")
        logger.debug("Test Debug Message")
        sleep(30)