https://prefect.io logo
#prefect-community
Title
# prefect-community
d

Dekel R

05/17/2022, 6:21 AM
Hey, I’m trying to configure Prefect’s logger and add a Logz.io handler. Can’t find any good example - can anyone help me with this? I configured a logger using this documentation https://docs.logz.io/shipping/log-sources/python.html but I can’t make Prefect’s “prefect.context.get(logger_name)” use it. Thanks.
1
a

Anna Geller

05/17/2022, 10:49 AM
This is usually handled via extra loggers - here and here you can find how to set this up. It may be that logz.io works similarly to loguru, in that case try this approach
👀 1
d

Dekel R

06/07/2022, 8:22 AM
Hey @Anna Geller Thanks - I added Prefect’s loggers like so and it works great -
Copy code
prefect_logger = get_logger()
stream_handler, cloud_handler = prefect_logger.handlers
logger.addHandler(stream_handler)
logger.addHandler(cloud_handler)
Another question - when running with this configuration -
Copy code
executor=LocalDaskExecutor(scheduler="processes")
I get no logs.. the logs aren’t shipped to logzio and I also cant see them at the cloud UI (but I can see statuses of tasks) Am I missing something? Is there anything else I should config while using LocalDaskExecutor? Thanks.
a

Anna Geller

06/07/2022, 12:06 PM
LocalDaskExecutor flows run tasks in separate processes, maybe you need to account for that with some env variables? sorry, I won't be too helpful here since I've never used logz.io
maybe someone from the community can help you
d

Dekel R

06/07/2022, 5:48 PM
Ok and what about the UI of Prefect cloud? The handler that I configured works great without Dask local excecuter but it seems like its broken when using it… Any ideas regarding this issue specifically? Does Prefect’s logger behaves in a different way while using Dask? Thx
a

Anna Geller

06/07/2022, 5:49 PM
yes it does when using Dask, but LocalDaskExecutor doesn't really use Dask, but rather multiprocessing and multithreading
d

Dekel R

06/07/2022, 5:59 PM
Yeah well its not my issue since I’m only using LocalDaskExecutor.. I hope that someone else had this issue and solved it. Thx
a

Anna Geller

06/07/2022, 6:04 PM
a good way of debugging this is taking it step by step - running first locally, then perhaps running on a local agent with local storage, then add your custom storage etc breaking it down this way you may find the issue easier
4 Views