Thanks @Kevin Kho! I tried warpping the addHandler in a Task, and it works! However, since the handler is executed after the flow begins, so the log written to the file misses the part like '[2022-02-22 15:31:49-0800] INFO - prefect.CloudFlowRunner | Beginning Flow run for 'testlog''......is there a workaround here? besides, is it recommended / necessary to remove the added handler at the end of the flow?