promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[Feature Request] Logging statements are not present in log output

Open bastbu opened this issue 1 year ago • 10 comments

Describe the bug

When emitting logging statements within a flow in prompt flow, they do not appear in the log output.

How To Reproduce the bug Steps to reproduce the behavior, how frequent can you experience the bug:

  1. In a Python node, emit a log using:
    • logger = logging.getLogger(__name__)
    • logger.warn("log statement")
  2. "log statement" should show up in the log output when running a flow

Expected behavior

"log statement" should show up in the log output when running a flow (and with that also in logs.txt).

Running Information(please complete the following information):

  • Promptflow Package Version using 1.4.1
  • Operating System: WSL on Windows 11
  • Python Version using Python (Linux) 3.9.18

bastbu avatar Jan 31 '24 12:01 bastbu

Thank you for your feedback. We will fix this issue in the future.

PeiwenGaoMS avatar Feb 01 '24 03:02 PeiwenGaoMS

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 Mar 02 '24 21:03 github-actions[bot]

@thy09 this issue was closed as not planned. I can't reactivate the issue, can you please reopen it?

bastbu avatar Mar 11 '24 07:03 bastbu

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 Apr 12 '24 21:04 github-actions[bot]

Hi @bastbu , after review, this should be considered a feature request. We will consider enabling logging in the tool in the future. Thank you for your feedback.

PeiwenGaoMS avatar Apr 25 '24 04:04 PeiwenGaoMS

Is there any temporary solution in place? We are planning to use prompt flow in production and would like to add our own logs. Even setting my own logging configuration like this: logging.basicConfig(filename="sample.log", level=logging.WARNING") is not even saving my logs to any file.

sofyanajridi avatar Jul 09 '24 10:07 sofyanajridi

Is there any solution to this? I can't see print statements either

anuar12 avatar Sep 16 '24 06:09 anuar12

Following up, even setting the below, I don't see any of my own logging output in the logs:

import logging
os.environ["PF_LOGGING_LEVEL"] = "DEBUG"
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

corticalstack avatar Nov 26 '24 10:11 corticalstack

A crappy solution is to just use print to help at least with debugging. Would be very beneficial to get proper custom logging to work, as figuring out what happens inside python tools without this functionality is far from ideal.

islet-anttiluoto avatar Jan 16 '25 09:01 islet-anttiluoto