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 <[email protected]>
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());
     }
 }
 

Reply via email to