You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Mingliang Liu (Jira)" <ji...@apache.org> on 2022/11/24 01:28:00 UTC

[jira] [Created] (FLINK-30179) Stop stringifying exception for logging

Mingliang Liu created FLINK-30179:
-------------------------------------

             Summary: Stop stringifying exception for logging
                 Key: FLINK-30179
                 URL: https://issues.apache.org/jira/browse/FLINK-30179
             Project: Flink
          Issue Type: Improvement
          Components: Runtime / Task
    Affects Versions: 1.16.0
            Reporter: Mingliang Liu


In {{org.apache.flink.runtime.taskmanager.Task}} there are multiple places where we stringify an exception before logging. According to Slf4j logging, we can just leave the last argument as exception (or throwable) without fitting them into log message string with placeholders.

So essentially:
{code}
LOG.debug(
        "{} ({}) switched from {} to {} due to CancelTaskException: {}",
        taskNameWithSubtask,
        executionId,
        currentState,
        newState,
        ExceptionUtils.stringifyException(cause));
{code}
should be
{code}
LOG.debug(
        "{} ({}) switched from {} to {} due to CancelTaskException:",
        taskNameWithSubtask,
        executionId,
        currentState,
        newState,
        cause);
{code}

Interestingly there was a [hot fix|https://github.com/apache/flink/commit/7eac5c62a10158ef210906deb161ac791f18d3ae] that deliberately changed the code from the latter to the former. This JIRA can track the discussion why that was needed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)