Hi everyone! I'm having issues getting logs displa...
# ask-community
j
Hi everyone! I'm having issues getting logs displayed in UI (prefect server, local agent) from a local package that has it's own logging setup i.e. I'm not setting up logs at task level, I want to use the module's own defined logs. I had a look at the different threads after searching for "extra loggers", I'm following the steps already mentioned in several threads and in the docs. I'm attaching the flow and the package code for reference. The package is
adls_utils
, I'm using a
logging.conf
file that gets read in the main module
dataproject.py
. The flow is
adls_create_day_dirs.py
. I start the local agent with the
local_agent_start.txt
to set environment variables, i.e. that's where I set
PREFECT__LOGGING__EXTRA_LOGGER
. @Jim Crist-Harif saw you've helped other people with this topic before, hence the mention but feel free to leave it for the community to answer :)
k
Hey @Julio Venegas, I don’t think we’ll be able to give you a step-by-step walkthrough to get this logger in place with your Server deployment - there is likely a lot of customization needed, are you running into a specific issue?
j
There's no error to report, is more a configuration issue.
dataproject.py
has a class that will be used beyond Prefect flows, so it has it's own logging in place using the
logging
module from the standard library. The flow
adls_create_day_dirs.py
imports from
dataproject
but the UI won't show any of the info level logs defined in
dataproject
😞 I'd like to avoid code duplication if possible, otherwise I guess I can set task level logs.
👀 1
k
Hmm, since a Resource Manager is an object consisting of Tasks - I think you can
log_stdout=True
 for each task (in your case init, setup, cleanup) to propagate those logs to the UI. I’ll need to get more information on this and get back to you!
Apologies Julio, looks like this ^ isn’t a great solution for this use case. After reviewing this thread on configuring a custom logger with this supplemental repo, everything in your configurations is looking good. One difference I could discern includes the usage of a resource manager, so it may be worth trying a single function with your
logging.conf
settings to narrow the issue and rule out nested logs. If things still aren’t functioning, let us know and we’ll get you sorted.
j
@Kyle Moon-Wright I HAD A FREAKING TYPO
PREFECT__LOGGING__EXTRA_LOGGER="['adls_utils']"
EXTRA_LOGGER instead of EXTRA_LOGGER*S*. But logs are working now 🙂 Still kinda of afraid that I have no proper understanding of the logging functionality for Prefect but I'm still quite new to the project. Thanks a lot for the help and being so responsive!
k
Oh brother I should’ve caught that, haha. Nice catch! 🚀