k

    Kevin Weiler

    1 year ago
    Hi there! I’m trying to set the
    extra_loggers
    config at the level of my flow (as described here) but it’s not having the desired effect (logging stuff from my imported code)
    I’m on
    0.15.1
    this is my flow:
    from prefect import task, Flow
    from prefect.executors import LocalDaskExecutor
    from prefect.storage import Docker
    from prefect.run_configs import LocalRun, DockerRun
    
    from research.example_pkg import things
    
    @task()
    def run_thing1():
        if things.thing1():
            return True
    
    @task()
    def run_thing2():
        if things.thing2():
            return True
    
    if __name__ == "__main__":
        with Flow("test_flow", executor=LocalDaskExecutor(scheduler="processes")) as flow:
            if run_thing1():
                thing2_var = run_thing2()
    
        flow.run_config = LocalRun(
            env={
                "PREFECT__LOGGING__LEVEL": "DEBUG",
                "PREFECT__LOGGING__EXTRA_LOGGERS": '["research"]'
            }
        )
        flow.run()
    running that file doesn’t give me logged output from the imported “things”
    but if I export
    PREFECT__LOGGING__EXTRA_LOGGERS='["research"]'
    prior to running that flow file - it seems to work
    is there anyway to set that logging config when creating the flow?
    Kevin Kho

    Kevin Kho

    1 year ago
    Hi @Kevin Weiler, is this a custom module? I’m not sure this will help but could you try
    "['research']"
    instead? double quotes on the outside.