Hey, I’m trying to configure Prefect’s logger and ...
# prefect-community
d
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
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
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
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
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
yes it does when using Dask, but LocalDaskExecutor doesn't really use Dask, but rather multiprocessing and multithreading
d
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
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