Slackbot
06/13/2023, 2:42 PMPim Claessens
06/13/2023, 2:46 PMPim Claessens
06/13/2023, 2:46 PMMarvin
06/13/2023, 2:48 PMlogging.yml
configuration file to customize Prefect logging. Use Prefect's default logging configuration as a starting point by copying its text into a new file. Note that this log configuration requires Prefect 2.6 or later.
Next, place your logging configuration in a file named logging.yml
in Prefect's home directory. The default Prefect home directory varies by operating system:
- /home/<username>/.prefect
on Linux
- /Users/<username>/.prefect
on macOS
- C:\Users\<username>\.prefect
on Windows
You can override any logging configuration by setting an environment variable or Prefect Profile setting using the syntax PREFECT_LOGGING_[PATH]_[TO]_[KEY]
, with [PATH]_[TO]_[KEY]
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 PREFECT_LOGGING_LEVEL="DEBUG"
.
You may also configure the "root" Python logger.
Here's an example of how to start a Prefect agent with a custom log file:
bash
$ PREFECT_LOGGING_HANDLERS_FILE_FILENAME=/var/log/prefect-agent1.log prefect agent start -q default
This will start the Prefect agent and log its output to /var/log/prefect-agent1.log
.
For more information, check out this discourse post.
Now go forth and log your heart out, human.