<@ULVA73B9P> Show me an example how to deduce `PRE...
# marvin-in-the-wild
x
@Marvin Show me an example how to deduce
PREFECT_LOGGING_[PATH]_[TO]_[KEY]?
m
It seems there was an error when retrieving the specific documentation about
PREFECT_LOGGING_[PATH]_[TO]_[KEY]?
. However, I found a relevant code example for logging configuration in a flow:
Copy code
python
from prefect import flow

@flow(log_prints=True)  # send `print` statements as INFO logs
def my_workflow():
    print("I can call any python code here, including prefect tasks or flows")

if __name__ == "__main__":
    my_workflow()  # call it like a normal python function
    
    # or serve it as a long-lived process
    # my_workflow.serve("my-deployment-name")
(Link to source here) Let me refine the search for the specific documentation you requested. Oh joy, another glitch. Let's try a different strategy to fetch the information about configuring logging keys in Prefect. One moment. Here's what I found in the GitHub issues related to Prefect logging configuration: 1. Issue: Importing prefect kills
uvicorn
app's log messages
Prefect's logging setup seems to interfere with `uvicorn`'s default logging. More details here. 2. Issue: Adding logging attributes raises error when running on
dask
There was a problem with setting
PREFECT__LOGGING__LOG_ATTRIBUTES
, where users try to add extra log attributes and face issues. Details can be found here. Let's illustrate a configuration snippet from the second issue: Start your agent with the required logging attributes:
Copy code
bash
PREFECT__LOGGING__LOG_ATTRIBUTES="['uuid']" PREFECT__LOGGING__FORMAT="%(message)s | %(uuid)s" ipython
Then in your Prefect task or flow:
Copy code
python
import prefect
logger = prefect.utilities.logging.get_logger()

with prefect.context(uuid="42"):
    logger.debug("hi")
This will produce the expected log output:
Copy code
hi | 42
You can refer to the issue link for more detailed context and troubleshooting. Hopefully, this helps in configuring your logging in Prefect correctly. If you have more specific details or need further assistance, feel free to ask!
x
I want to set loggers.prefect.flow_runs log level to DEBUG, how to set it through env var?
@Marvin I want to set loggers.prefect.flow_runs log level to DEBUG, how to set it through env var?
m
Well, this seems unnecessarily yet predictably frustrating. The documentation search and GitHub issues didn't yield specific results for setting
loggers.prefect.flow_runs
to
DEBUG
. However, based on general logging configurations of Prefect, you can set the logging level using environment variables. Try setting the following environment variable:
Copy code
bash
PREFECT_LOGGING__LEVEL="DEBUG"
If this needs to be specifically for
loggers.prefect.flow_runs
, you might need a more granular configuration:
Copy code
bash
PREFECT_LOGGING__LOGGERS__prefect__flows__LEVEL="DEBUG"
This approach follows the naming convention used in Prefect's logging setup, but due to the lack of documentation verification, please verify by testing in your environment. For more precise details, you might want to delve directly into Prefect's logging utilities or configuration documentation once the systems behave properly. If you encounter further issues or if this configuration doesn't work as expected, let me know, and I'll attempt another search or suggest additional methods.