I have logger class which i am using for my code. ...
# ask-community
r
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
Hey @Raviraja Ganta, you need to define an extra logger liek this
r
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
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