<@ULVA73B9P> I have a python project with multiple...
# ask-marvin
d
@Marvin I have a python project with multiple existing loggers that log to files. When I add prefect 3 decorators these loggers no longer log to the files. I don't want these loggers to connect to Prefect, I just want them to keep logging to files like they did before.
m
Your issue with the loggers not logging to files after adding Prefect decorators might be due to Prefect's default logging configuration affecting the root logger. By default, Prefect configures the root logger to output logs to the console, which may interfere with your existing file logging setup. To resolve this, you can configure your loggers to explicitly disable log propagation to the root logger. This ensures that your logs are not affected by Prefect's logging settings. Additionally, you can modify the Prefect logging configuration to better suit your needs. Here's what you can do: 1. Disable Propagation: Ensure that your loggers have propagation disabled. This can be done by setting
logger.propagate = False
for each of your loggers. 2. Custom Logging Configuration: You can create a custom
logging.yml
file to override Prefect's logging settings. Place this file in your
PREFECT_HOME
directory. More details on configuring logging can be found in the Prefect 3 logging documentation. By following these steps, your existing loggers should function independently of Prefect's logging system and continue to log to files as intended.
d
The instructions say: To use a normal Python logger anywhere with your same configuration, use
get_logger()
from
prefect.logging
.