Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

enhancing logging (#23332)

znnab78e1208996
diff --git a/api/core/plugin/impl/base.py b/api/core/plugin/impl/base.py
index 7375726fa97..6f32498b429 100644
--- a/api/core/plugin/impl/base.py
+++ b/api/core/plugin/impl/base.py
@@ -208,6 +208,7 @@ class BasePluginClient:
except Exception:
raise PluginDaemonInnerError(code=rep.code, message=rep.message)
+ logger.error("Error in stream reponse for plugin %s", rep.__dict__)
self._handle_plugin_daemon_error(error.error_type, error.message)
raise ValueError(f"plugin daemon: {rep.message}, code: {rep.code}")
if rep.data is None:
diff --git a/api/core/plugin/impl/exc.py b/api/core/plugin/impl/exc.py
index 8b660c807d1..8ecc2e21474 100644
--- a/api/core/plugin/impl/exc.py
+++ b/api/core/plugin/impl/exc.py
@@ -2,6 +2,8 @@ from collections.abc import Mapping
from pydantic import TypeAdapter
+from extensions.ext_logging import get_request_id
+
class PluginDaemonError(Exception):
"""Base class for all plugin daemon errors."""
@@ -11,7 +13,7 @@ class PluginDaemonError(Exception):
def __str__(self) -> str:
# returns the class name and description
- return f"{self.__class__.__name__}: {self.description}"
+ return f"req_id: {get_request_id()} {self.__class__.__name__}: {self.description}"
class PluginDaemonInternalError(PluginDaemonError):