How to print infomation in code execution nodes of the workflow? #7751

Closed
opened 2026-02-21 18:22:10 -05:00 by yindo · 2 comments
Owner

Originally created by @duxiaoyang06 on GitHub (Jan 16, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

The code execution nodes in the workflow, how to debug them? Using print or the logging package doesn't output debug information in the docker -f docker-api-1.
image

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @duxiaoyang06 on GitHub (Jan 16, 2025). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. The code execution nodes in the workflow, how to debug them? Using `print` or the `logging` package doesn't output debug information in the `docker -f docker-api-1`. ![image](https://github.com/user-attachments/assets/235c41c4-60da-49df-ac79-f572b7286b4d) ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 🙋‍♂️ question label 2026-02-21 18:22:10 -05:00
yindo closed this issue 2026-02-21 18:22:10 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 16, 2025):

@duxiaoyang06 Hello! I'm here to assist you with any bugs, questions, or contributions you have regarding the workflow. I'm an expert bot and can help you while you wait for a human maintainer.

To print information or debug code execution nodes in Dify workflows, you can use Python's logging module. Dify's code execution nodes handle logging internally by setting up logging handlers, including a RotatingFileHandler for logging to a file and a StreamHandler for logging to the console. The log output is directed to both the specified log file and the console (stdout) [1].

If you're not seeing the output in your Docker logs, ensure that the logging configuration in your Dify setup is correctly set to output to the console. You might need to check the dify_config settings to ensure that the log level and handlers are configured to capture the desired output. Additionally, make sure that the logging level is set to capture debug information (e.g., DEBUG level).

If you are using print statements and they are not appearing, consider replacing them with logging calls, such as logging.debug(), logging.info(), etc., to ensure they are captured by the logging system.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 16, 2025): <!-- Greeting --> @duxiaoyang06 Hello! I'm here to assist you with any bugs, questions, or contributions you have regarding the workflow. I'm an expert bot and can help you while you wait for a human maintainer. <!-- Answer --> To print information or debug code execution nodes in Dify workflows, you can use Python's `logging` module. Dify's code execution nodes handle logging internally by setting up logging handlers, including a `RotatingFileHandler` for logging to a file and a `StreamHandler` for logging to the console. The log output is directed to both the specified log file and the console (stdout) <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/extensions/ext_logging.py)</sup>. If you're not seeing the output in your Docker logs, ensure that the logging configuration in your Dify setup is correctly set to output to the console. You might need to check the `dify_config` settings to ensure that the log level and handlers are configured to capture the desired output. Additionally, make sure that the logging level is set to capture debug information (e.g., `DEBUG` level). If you are using `print` statements and they are not appearing, consider replacing them with logging calls, such as `logging.debug()`, `logging.info()`, etc., to ensure they are captured by the logging system. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/3d6d8ad2-c4f6-4ed5-ba0c-007fd1d716d4?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/3d6d8ad2-c4f6-4ed5-ba0c-007fd1d716d4?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/3d6d8ad2-c4f6-4ed5-ba0c-007fd1d716d4?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/3d6d8ad2-c4f6-4ed5-ba0c-007fd1d716d4?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3d6d8ad2-c4f6-4ed5-ba0c-007fd1d716d4?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/3d6d8ad2-c4f6-4ed5-ba0c-007fd1d716d4?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Jan 20, 2025):

For questions please use discussion instead. We do not support use print in workflow.

@crazywoola commented on GitHub (Jan 20, 2025): For questions please use discussion instead. We do not support use print in workflow.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7751