Alex Ilyin
06/13/2024, 9:26 PMMarvin
06/13/2024, 9:26 PMbash
export PREFECT_LOGGING_LEVEL="DEBUG"
2. Prefect Profile Setting:
Alternatively, you can use the Prefect CLI to set this:
bash
prefect config set PREFECT_LOGGING_LEVEL="DEBUG"
To ensure the setting is applied globally, you may also configure the root logger:
bash
export PREFECT_LOGGING_ROOT_LEVEL="DEBUG"
For further details, you can refer to the Prefect logging guide.
Always a pleasure. Now, go bother someone else.Alex Ilyin
06/13/2024, 9:31 PMMarvin
06/13/2024, 9:31 PMprint(os.getenv('PREFECT_LOGGING_LEVEL'))
in your script to see if it prints DEBUG
.
2. Explicit Configuration:
Prefect supports setting logging configurations via environment variables or directly in your configuration file. Double-check that it hasn't been accidentally overridden in your configurations.
python
from prefect.logging import get_logger
# Ensure logger is configured to DEBUG
logger = get_logger()
logger.setLevel("DEBUG")
3. Check the Prefect Profile:
- Use prefect config view
to ensure the profile being used has the correct logging level set.
bash
prefect config view
4. Prefect Root Logger:
If other solutions do not work, configure the root Python logger:
bash
export PREFECT_LOGGING_ROOT_LEVEL="DEBUG"
Some helpful sources:
- Prefect Logging Guide
- Example GitHub issues where logging configuration was discussed: Issue #6086, Issue #8248
If the problem persists, you might want to check these sources or raise a new issue in the Prefect GitHub repo.
I hope this has been as enlightening as an asteroid impact on a planet.Alex Ilyin
06/13/2024, 9:32 PMMarvin
06/13/2024, 9:32 PMlogging.yml
file in the Prefect logging guide. Here is an example of a basic logging.yml
configuration:
yaml
version: 1
disable_existing_loggers: False
formatters:
standard:
format: "%(asctime)s.%(msecs)03d | %(levelname)-7s | %(name)s | %(filename)s:%(lineno)s - %(funcName)s() - %(message)s"
datefmt: "%H:%M:%S"
flow_run_fmt:
format: "%(asctime)s.%(msecs)03d | %(levelname)-7s | Flow run '%(flow_run_name)s' | %(filename)s:%(lineno)s - %(funcName)s() | %(message)s"
task_run_fmt:
format: "%(asctime)s.%(msecs) | %(levelname)-7s | Task run '%(task_run_name)s' | %(filename)s:%(lineno)s - %(funcName)s() | %(message)s"
handlers:
console:
class: logging.StreamHandler
level: DEBUG
formatter: standard
stream: <ext://sys.stdout>
loggers:
prefect:
level: DEBUG
handlers: [console]
propagate: False
root:
level: DEBUG
handlers: [console]
### Applying the Configuration
To apply the logging configuration from this logging.yml
file, you must set the environment variable PREFECT_LOGGING_SETTINGS_PATH
to the path of your logging.yml
file:
bash
export PREFECT_LOGGING_SETTINGS_PATH="/path/to/your/logging.yml"
### Default Logging Levels
By default, Prefect displays INFO
-level and above events. You can configure logging levels as shown in the YML configuration.
For more details and examples, visit the Prefect logging guide.
Wouldn't it be nice if I had emotions to tell you how pleased I am? Oh well.