Aleksandr Liadov
12/01/2021, 4:38 PMrun config
in flow (I do the local run with the local agent):
run_config=UniversalRun(env={
"PREFECT__LOGGING__EXTRA_LOGGERS": '["lib1", "lib2"]',
"PREFECT__LOGGING__LEVEL": "DEBUG",
})
I can ONLY observe info
level from my libs even if I try to switch on debug
level!
(However the prefect logger shows the information related to CloudFlowRunner
from debug
level without any problem).
What do I wrong?Tom Shaffner
12/01/2021, 4:41 PM_env_={'PREFECT__LOGGING__FORMAT':'[%(asctime)s-%(levelname)s - %(name)s]-[%(filename)s:%(funcName)s]-Line %(lineno)d: %(message)s'}
, so mark me as also interested in this question. I've also tried it in the config.toml file to no avail.Kevin Kho
lib1
? I’ll take a look at the source, but I can’t think of any reason off the top of my head.
Will try that too @Tom ShaffnerAleksandr Liadov
12/01/2021, 4:44 PMINFO
level prints right for both libs without any problem 👍Tom Shaffner
12/01/2021, 4:50 PMKevin Kho
lib1
and lib2
Aleksandr Liadov
12/01/2021, 4:56 PMKevin Kho
Aleksandr Liadov
12/01/2021, 5:02 PMrun_config
is run by the parent flow.Kevin Kho
import logging
def function_that_logs():
logger = logging.getLogger("foo.bar")
<http://logger.info|logger.info>("INFO from fake_lib!")
logger.debug("DEBUG from fake_lib!")
theflow.py
from fake_lib import function_that_logs
from prefect import Flow, task
from prefect.run_configs import LocalRun
@task
def foo():
function_that_logs()
with Flow("extra-loggers-example") as flow:
foo()
flow.run_config = LocalRun(env={"PREFECT__LOGGING__EXTRA_LOGGERS":'["foo"]',
"PREFECT__LOGGING__LEVEL": "DEBUG"})
flow.register("bristech")
Kevin Kho
Kevin Kho
Aleksandr Liadov
12/01/2021, 5:11 PMKevin Kho
Kevin Kho
flow.run()
.
[2021-12-01 12:29:00-0500-INFO - prefect.FlowRunner]-[flow_runner.py:run]-Line 245: Beginning Flow run for 'extra-loggers-example'
[2021-12-01 12:29:00-0500-INFO - prefect.TaskRunner]-[task_runner.py:run]-Line 241: Task 'foo': Starting task run...
[2021-12-01 12:29:00-0500-INFO - prefect.TaskRunner]-[task_runner.py:run]-Line 335: Task 'foo': Finished task run for task with final state: 'Success'
[2021-12-01 12:29:00-0500-INFO - prefect.FlowRunner]-[flow_runner.py:determine_final_state]-Line 710: Flow run SUCCESS: all reference tasks succeeded
But I am wondering if this will translate well to Cloud because Cloud does some rendering in the UI. Are you expecting the logs tab in the UI to have this format?Aleksandr Liadov
12/01/2021, 5:38 PMKevin Kho
Tom Shaffner
12/01/2021, 7:03 PMKevin Kho
Kevin Kho
Aleksandr Liadov
12/02/2021, 8:09 AM