You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ma...@apache.org on 2022/11/25 01:39:18 UTC

[flink] branch master updated: [FLINK-30179][runtime] Stop stringifying exception for logging (#21379)

This is an automated email from the ASF dual-hosted git repository.

mapohl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new b77a9814a07 [FLINK-30179][runtime] Stop stringifying exception for logging (#21379)
b77a9814a07 is described below

commit b77a9814a0769880d4dc9937a9dd1525cc16140a
Author: Mingliang Liu <li...@apache.org>
AuthorDate: Thu Nov 24 17:39:04 2022 -0800

    [FLINK-30179][runtime] Stop stringifying exception for logging (#21379)
    
    Additionally, a duplicate log statement is fixed.
---
 .../org/apache/flink/runtime/taskmanager/Task.java | 33 ++++++++++++----------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
index 2f65781984f..6dff6974e47 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
@@ -1074,30 +1074,33 @@ public class Task
                         currentState,
                         newState);
             } else if (ExceptionUtils.findThrowable(cause, CancelTaskException.class).isPresent()) {
-                LOG.info(
-                        "{} ({}) switched from {} to {} due to CancelTaskException.",
-                        taskNameWithSubtask,
-                        executionId,
-                        currentState,
-                        newState);
-                LOG.debug(
-                        "{} ({}) switched from {} to {} due to CancelTaskException: {}",
-                        taskNameWithSubtask,
-                        executionId,
-                        currentState,
-                        newState,
-                        ExceptionUtils.stringifyException(cause));
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug(
+                            "{} ({}) switched from {} to {} due to CancelTaskException:",
+                            taskNameWithSubtask,
+                            executionId,
+                            currentState,
+                            newState,
+                            cause);
+                } else {
+                    LOG.info(
+                            "{} ({}) switched from {} to {} due to CancelTaskException.",
+                            taskNameWithSubtask,
+                            executionId,
+                            currentState,
+                            newState);
+                }
             } else {
                 // proper failure of the task. record the exception as the root
                 // cause
                 failureCause = cause;
                 LOG.warn(
-                        "{} ({}) switched from {} to {} with failure cause: {}",
+                        "{} ({}) switched from {} to {} with failure cause:",
                         taskNameWithSubtask,
                         executionId,
                         currentState,
                         newState,
-                        ExceptionUtils.stringifyException(cause));
+                        cause);
             }
 
             return true;