Max Lei
10/05/2020, 12:45 AMdef setup_logs():
# Example config
'root': {
'level': 'DEBUG',
'handlers': [
'console',
'info_file_handler',
'fluent'
]
}
logging.config.dictConfig(logging_config)
class DoSomething():
def run(self):
setup_logs()
<http://logger.info|logger.info>("Here")
The logging configurations sets up a default logger to stdout, a file handler, and also to a 3rd party log streaming service using fluent. I see the local file output, but not through the prefect UI.
export PREFECT__LOGGING__EXTRA_LOGGERS="['root']"
[logging]
extra_loggers = "['root']"
I have setup a toml file, and tried to set the environmental variable before running the agent, and the flow itself. However I still do not see the logs in the prefect UI.
Is there something else I need to do?Chris White
extra_loggers
configuration will add the appropriate logging handlers to your loggers at the first import-time of Prefect.
Instead of creating an entirely new logger to re-route logs to a third party service, I recommend adding your additional handlers to the root prefect logger (which is already configured for the Prefect API):
prefect_logger = prefect.utilities.configuration.logging.get_logger()
# add additional handlers to the prefect logger here