Vincent Chéry
07/23/2025, 1:18 PMMarvin
07/23/2025, 1:18 PMMarvin
07/23/2025, 1:18 PMlog_prints=True
in your flow decorators. Here's an example:
python
from prefect import flow
@flow(log_prints=True)
def parent_flow():
print("Parent flow log")
child_flow()
@flow(log_prints=True)
def child_flow():
print("Child flow log")
3. In the Prefect UI:
- You can see the parent flow run
- Child flow runs will be linked to the parent
- You can access logs for both parent and child flows through their respective run pages
The logs are maintained separately but are easily accessible through the UI's flow run hierarchy. This separation actually provides better organization and clarity when debugging or monitoring your workflows, as you can easily distinguish between logs from different parts of your workflow.
Note that child flows run in the same process as their parent flow by default, which helps maintain a streamlined logging experience. You can find more details about this in the migration guide and workflow design patterns documentation.Vincent Chéry
07/23/2025, 1:20 PMMarvin
07/23/2025, 1:20 PMMarvin
07/23/2025, 1:21 PMVincent Chéry
07/23/2025, 1:31 PMMarvin
07/23/2025, 1:32 PMMarvin
07/23/2025, 1:33 PMlog_prints=True
, print statements are captured and sent to the Prefect backend, but:
- Each flow (parent and child) maintains its own separate log stream
- Print statements from child flows do NOT automatically appear in the parent flow's logs
- You need to check the child flow's run logs separately in the UI
To properly track print statements from both parent and child flows, you would need to:
1. Enable log_prints=True
on both flows:
python
from prefect import flow
@flow(log_prints=True)
def parent_flow():
print("Parent flow message")
child_flow()
@flow(log_prints=True)
def child_flow():
print("Child flow message")
2. To see all the print statements:
- Navigate to the parent flow run in the UI
- Click through to the child flow run to see its prints
- Each flow's prints will be visible in their respective run logs
If you need to aggregate or combine logs from parent and child flows, you might need to consider:
1. Implementing a custom logging solution
2. Using an external logging service
3. Passing information explicitly between flows if needed
Would you like me to research specific approaches for combining or aggregating logs from parent and child flows? This could help find a workaround for your use case.