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

Raviraja Ganta

04/30/2022, 11:10 AM
I have logger class which i am using for my code. But the logs printed using that is not coming in prefect UI. Only the ones used with
prefect.context.get("logger")
is coming in the UI. How to surface my custom logger method logs also into the UI?
k

Kevin Kho

04/30/2022, 2:50 PM
Hey @Raviraja Ganta, you need to define an extra logger liek this
r

Raviraja Ganta

04/30/2022, 6:55 PM
Didn't understand what to configure.
Copy code
logger = loggers.create_logger(
    project_name="prefect_example", level="INFO", json_logging=False
)

prefect.config.logging.extra_loggers = [logger]
Tried this.. didn't work
k

Kevin Kho

05/01/2022, 2:23 AM
It’s the logger name, and you don’t configure it mid-run because the
config
can’t be mutated during a flow run. It has to happen at flow start so you need the environment variables or you need it in the RunConfiguration of you flow
5 Views