Developing Dify Plugins
Outputting Logs for Plugin Development and Debugging
Learn how to add logging to your Dify plugin tools for development and debugging purposes.
As a plugin developer, you may want to print arbitrary strings to logs during plugin processing for development or debugging purposes.
For this purpose, the plugin SDK implements a handler for Python’s standard logging
library. By using this, you can output any string to both the standard output during remote debugging and the plugin daemon container logs (community edition only).
Sample
Import plugin_logger_handler
and add it to your logger as a handler. Below is a sample code for a tool plugin.