You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by li...@apache.org on 2026/01/08 08:26:46 UTC
(shenyu) 05/07: refactor: streamline logging in Shenyu plugin lifecycle methods
This is an automated email from the ASF dual-hosted git repository.
liuhongyu pushed a commit to branch feat/refactor
in repository https://gitbox.apache.org/repos/asf/shenyu.git
commit 46b8b2d9ab92338316379139f66a1b7af2dffe09
Author: liuhy <li...@apache.org>
AuthorDate: Thu Jan 8 16:22:37 2026 +0800
refactor: streamline logging in Shenyu plugin lifecycle methods
---
.../src/main/java/org/apache/shenyu/plugin/api/ShenyuPlugin.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/ShenyuPlugin.java b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/ShenyuPlugin.java
index 6fef76e8f1..22cfe72963 100644
--- a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/ShenyuPlugin.java
+++ b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/ShenyuPlugin.java
@@ -148,11 +148,9 @@ public interface ShenyuPlugin {
*/
default void after(ServerWebExchange exchange) {
long currentTimeMillis = System.currentTimeMillis();
- Object startTime = exchange.getAttributes().get(Constants.PLUGIN_START_TIME + named());
- if (Objects.nonNull(startTime)) {
- LOG.debug("shenyu traceId:{}, plugin named:{}, cost:{}", exchange.getLogPrefix(), named(), currentTimeMillis - (long) startTime);
- exchange.getAttributes().remove(Constants.PLUGIN_START_TIME + named());
- }
+ long startTime = (long) exchange.getAttributes().get(Constants.PLUGIN_START_TIME + named());
+ LOG.debug("shenyu traceId:{}, plugin named:{}, cost:{}", exchange.getLogPrefix(), named(), currentTimeMillis - startTime);
+ exchange.getAttributes().remove(Constants.PLUGIN_START_TIME + named());
}
}