promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[Feature Request] Logging configuration

Open martin-weber opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe. Currently the logging of Prompt Flow seems to be configured in the framework code. Therefore the loglevel seems to be not be not configurable on a deployed endpoint. This can result in many and big log entries when the logs are collected as some of the log message contain the raw data, see point 1 below.

  1. Log levels: Some log statements such as in logger.info(f"PromptFlow executor received data: {raw_data}") in app.score() or logger.info(f"Validating flow input with data {data!r}") use logger.info() to print out the raw request data which results in potentially big log entries. When log collection is enabled on a deployed endpoint, this results in big log entries.
  2. print vs logger: In some places print() is used in the framework instead of the loggger, see: print_yellow_warning(message) and print_red_error(message)
    It looks like the prints are not in the logs. Is the intention to use print only for the local development environment?

Describe the solution you'd like It would be great to be able to control the logging outputs via configuration:

  1. Be able to configure the log-level when deploying the application by providing a config file or environment variables.
  2. Log every output via the logger with the appropriate log-level and do not use print statements so that logger configuration as requested in 1. applies in a consistent way to all outputs.
  3. Use logger.debug for outputs with potentially big content as the whole content is mainly interesting when debugging but less for info used in production.

Describe alternatives you've considered We did not find any maintainable alternatives as these features are inside the promptflow library.

Additional context
None

martin-weber avatar Nov 15 '23 10:11 martin-weber

@martin-weber The log level in local would be available since v1.1.0, please reach the docs for more details. https://microsoft.github.io/promptflow/how-to-guides/faq.html#set-logging-level . We have removed the print, but there may still be some other logs needs to be adjusted, like the log level, or the content, that's a long way to go, feel free to open issue for your thoughts, we appreciate your feedback.

brynn-code avatar Nov 30 '23 06:11 brynn-code

Fantastic @brynn-code, thank you!

The Prompt Flow runtime image does not seem to have the latest version of the library, right?

Are there plans to update it soon?

fbeltrao avatar Dec 01 '23 12:12 fbeltrao

Hi @fbeltrao and @martin-weber , AML cloud deployment serving (with prompt flow runtime image) uses different code than the SDK local deployment serving. And the logging level support (through environment variable) for cloud scenario still rely on another feature of supporting environment variables in flow yaml. Will update when it's done for cloud.

doz-msft avatar Dec 05 '23 02:12 doz-msft

Hi @doz-msft and @brynn-code, Thanks for your answers. It is important for us to get this on the runtime image.

Which runtime image should we use? I see in the documentation on how-to-customize-environment-runtime that mcr.microsoft.com/azureml/promptflow/promptflow-runtime-stable:<newest_version> is used, which has no new version, see latest version.
It is also a different image than the one you linked above: https://mcr.microsoft.com/v2/azureml/promptflow/promptflow-runtime.

martin-weber avatar Dec 05 '23 14:12 martin-weber

HI @martin-weber , you should use promptflow-runtime-stable for customizing runtime as in the documentation. The promptflow-runtime is used for default runtime without customization. Currently, these images doesn't support configuring log level through environment variable PF_LOGGING_LEVEL in cloud (AML workspace), because it's not support to set environment variables when deploying a flow in cloud yet. We will support setting environment variables in flow yaml in next few weeks and can be used to configure log level with it.

doz-msft avatar Dec 06 '23 02:12 doz-msft

Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you!

github-actions[bot] avatar Jan 05 '24 21:01 github-actions[bot]