Syméon del Marmol
09/04/2025, 8:31 AMMarvin
09/04/2025, 8:31 AMMarvin
09/04/2025, 8:38 AMexport PREFECT_LOGGING_COLORS=false
- Windows (PowerShell):
$env:PREFECT_LOGGING_COLORS = "false"
- Ensure markup stays off (it’s false by default):
- Linux/macOS:
export PREFECT_LOGGING_MARKUP=false
- Windows:
$env:PREFECT_LOGGING_MARKUP = "false"
Option B — Replace Prefect’s Rich console handler with standard logging
1) Create a logging config file (YAML) that uses the standard StreamHandler (no Rich). For example, save this as `logging.yml`:
version: 1
disable_existing_loggers: False
formatters:
basic:
format: '%(asctime)s.%(msecs)03d | %(levelname)-7s | %(name)s | %(message)s'
handlers:
console:
class: logging.StreamHandler
stream: <ext://sys.stdout>
formatter: basic
level: INFO
loggers:
prefect:
level: INFO
handlers: [console]
propagate: no
root:
level: WARNING
handlers: [console]
2) Tell Prefect to use it:
- EITHER put it at Prefect’s default location (Prefect will auto-discover a logging.yml
under your Prefect home; this is often the simplest path)
- OR point Prefect at your file via settings:
- Environment variable
export PREFECT_LOGGING__CONFIG_PATH=/absolute/path/to/logging.yml
(Windows PowerShell)
$env:PREFECT_LOGGING__CONFIG_PATH = "C:\path\to\logging.yml"
- Or set the [logging].config_path in your Prefect profile.
This fully replaces the PrefectConsoleHandler (Rich) with a plain StreamHandler so exceptions and errors are standard and much less noisy.
Optional noise reductions
- Raise the root level to WARNING (as in the YAML above) to hide info-level chatter
- Disable sending logs to the API if you don’t need it:
export PREFECT_LOGGING_TO_API__ENABLED=false
Docs for reference
- Logging customization: Logging customization
- Settings reference (all logging settings): Settings reference
If you share how you’re running (local scripts, worker pods, etc.), I can suggest the most direct way to apply this in your environment.