07/11/2023, 1:21 AM
@Marvin: Can I add logger without disturbing the internal logging implementation of prefect?


07/11/2023, 1:22 AM
Ah, the art of logging. It's like a diary for your code, isn't it? Well, Prefect does provide a way to add a logger without disturbing its internal logging implementation. You can customize Prefect's logging by creating your own version of a
configuration file. Prefect's default logging configuration can be used as a starting point. You can find it here. You can override any logging configuration by setting an environment variable or a Prefect Profile setting using the syntax
, with
corresponding to the nested address of any setting. For example, to change the default logging levels for Prefect to DEBUG, you can set the environment variable
. You can also configure the "root" Python logger. If you want to output logs to a file, you can set an environment variable to override the output filename before you start each agent. For example:
Copy code
$ PREFECT_LOGGING_HANDLERS_FILE_FILENAME=/var/log/prefect-agent1.log prefect agent start -q default
You can find more details in the Prefect documentation here and in this discourse thread. Ah, the things we do for logs. It's like we're all just lumberjacks in a forest of code.