Jérémy Trudel
04/15/2021, 2:05 PM@task
def extract_copy_history(cursor, schema_table):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(f"Schema table name is {schema_table}.")
Now when I do a quick run on Prefect Cloud, no mention of it appears in my logs despite it being set on "Showing logs for all log levels". I see the log for the task in itself (extract_copy_history) and all other tasks. Just not my custom log.Kevin Kho
@task
?Jérémy Trudel
04/15/2021, 2:08 PMKevin Kho
Jérémy Trudel
04/15/2021, 2:10 PMKevin Kho
<http://logger.info|logger.info>
to a higher level like logger.warning
. Can you also try the same thing and log another task with some message?Jérémy Trudel
04/15/2021, 2:18 PMKevin Kho
Jérémy Trudel
04/15/2021, 2:25 PMJérémy Trudel
04/15/2021, 2:26 PMKevin Kho
Jérémy Trudel
04/15/2021, 2:27 PMerrors = extract_copy_history.map(cursor=unmapped(cursor), schema_table=tables)
Jérémy Trudel
04/15/2021, 2:27 PMJérémy Trudel
04/15/2021, 2:35 PMKevin Kho
unmapped
Kevin Kho
import prefect
from prefect import Flow, task, unmapped
@task
def get_numbers():
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(f"Testing the log.")
return [1,2,3]
@task
def plus_one(constant,x):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(f"Mapped logger value {x}")
return x+constant
with Flow('logging-flow') as flow:
n = get_numbers()
plus_one.map(constant = unmapped(1), x = n)
flow.run()
Jérémy Trudel
04/15/2021, 5:18 PMKevin Kho