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

zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 4d7f927805 [Improvement-17361][TaskPlugin] Use logger marker to 
exclude the system log in task instance log content. (#17378)
4d7f927805 is described below

commit 4d7f927805dd9e6bd02fe0e52db26b85a0fae058
Author: Wenjun Ruan <[email protected]>
AuthorDate: Wed Aug 6 10:18:57 2025 +0800

    [Improvement-17361][TaskPlugin] Use logger marker to exclude the system log 
in task instance log content. (#17378)
---
 .../src/test/resources/logback.xml                 |  2 +-
 .../src/main/resources/logback-spring.xml          |  2 +-
 .../task/executor/AbstractTaskExecutor.java        |  5 +--
 .../executor/eventbus/TaskExecutorEventBus.java    |  4 ++-
 .../eventbus/TaskExecutorEventBusCoordinator.java  |  5 +--
 .../TaskExecutorLifecycleEventRemoteReporter.java  |  4 ++-
 .../plugin/task/api/log/TaskInstanceLogHeader.java | 40 ++++------------------
 .../plugin/task/api/log/TaskLogDiscriminator.java  | 26 +++-----------
 .../plugin/task/api/log/TaskLogFilter.java         | 23 ++++++++++++-
 .../{TaskLogFilter.java => TaskLogMarkers.java}    | 28 +++++++--------
 .../shell/BaseLinuxShellInterceptorBuilder.java    |  8 ++---
 .../plugin/task/api/utils/LogUtils.java            |  2 +-
 .../worker/executor/PhysicalTaskExecutor.java      |  5 ++-
 .../src/main/resources/logback-spring.xml          |  2 +-
 14 files changed, 68 insertions(+), 88 deletions(-)

diff --git a/dolphinscheduler-master/src/test/resources/logback.xml 
b/dolphinscheduler-master/src/test/resources/logback.xml
index 044efca708..799791fd20 100644
--- a/dolphinscheduler-master/src/test/resources/logback.xml
+++ b/dolphinscheduler-master/src/test/resources/logback.xml
@@ -43,7 +43,7 @@
                 <file>${taskInstanceLogFullPath}</file>
                 <encoder>
                     <pattern>
-                        [%level] %date{yyyy-MM-dd HH:mm:ss.SSS Z} - %message%n
+                        %date{yyyy-MM-dd HH:mm:ss.SSS} %-5level - %message%n
                     </pattern>
                     <charset>UTF-8</charset>
                 </encoder>
diff --git 
a/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml 
b/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml
index d219cc6822..1380995f90 100644
--- a/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml
+++ b/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml
@@ -64,7 +64,7 @@
                 <file>${taskInstanceLogFullPath}</file>
                 <encoder>
                     <pattern>
-                        %date{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] - 
%message%n
+                        %date{yyyy-MM-dd HH:mm:ss.SSS} %-5level - %message%n
                     </pattern>
                     <charset>UTF-8</charset>
                 </encoder>
diff --git 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/AbstractTaskExecutor.java
 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/AbstractTaskExecutor.java
index f75f369eb4..79a0b4af39 100644
--- 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/AbstractTaskExecutor.java
+++ 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/AbstractTaskExecutor.java
@@ -21,6 +21,7 @@ import org.apache.dolphinscheduler.common.enums.Flag;
 import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
 import org.apache.dolphinscheduler.plugin.task.api.log.TaskInstanceLogHeader;
+import org.apache.dolphinscheduler.plugin.task.api.log.TaskLogMarkers;
 import org.apache.dolphinscheduler.task.executor.eventbus.TaskExecutorEventBus;
 import 
org.apache.dolphinscheduler.task.executor.events.TaskExecutorStartedLifecycleEvent;
 import 
org.apache.dolphinscheduler.task.executor.exceptions.TaskExecutorRuntimeException;
@@ -125,9 +126,9 @@ public abstract class AbstractTaskExecutor implements 
ITaskExecutor {
     protected abstract void doTriggerTaskPlugin();
 
     protected void initializeTaskContext() {
-        log.info("Begin to initialize taskContext");
         taskExecutionContext.setStartTime(System.currentTimeMillis());
-        log.info("End initialize taskContext {}", 
JSONUtils.toPrettyJsonString(taskExecutionContext));
+        log.info(TaskLogMarkers.excludeInTaskLog(), "Initialized taskContext 
{}",
+                JSONUtils.toPrettyJsonString(taskExecutionContext));
     }
 
     private void publishTaskRunningEvent() {
diff --git 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBus.java
 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBus.java
index 3cadadbec7..4e1a94a2bd 100644
--- 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBus.java
+++ 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBus.java
@@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.task.executor.eventbus;
 
 import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.eventbus.AbstractDelayEventBus;
+import org.apache.dolphinscheduler.plugin.task.api.log.TaskLogMarkers;
 import 
org.apache.dolphinscheduler.task.executor.events.AbstractTaskExecutorLifecycleEvent;
 
 import lombok.extern.slf4j.Slf4j;
@@ -28,7 +29,8 @@ public class TaskExecutorEventBus extends 
AbstractDelayEventBus<AbstractTaskExec
 
     public void publish(final AbstractTaskExecutorLifecycleEvent event) {
         super.publish(event);
-        log.info("Publish {}: {}", event.getClass().getSimpleName(), 
JSONUtils.toPrettyJsonString(event));
+        log.info(TaskLogMarkers.excludeInTaskLog(), "Publish {}: {}", 
event.getClass().getSimpleName(),
+                JSONUtils.toPrettyJsonString(event));
     }
 
 }
diff --git 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBusCoordinator.java
 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBusCoordinator.java
index c90f65ed09..1ced554bc7 100644
--- 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBusCoordinator.java
+++ 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorEventBusCoordinator.java
@@ -21,6 +21,7 @@ import static 
com.google.common.base.Preconditions.checkNotNull;
 
 import org.apache.dolphinscheduler.common.thread.ThreadUtils;
 import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.plugin.task.api.log.TaskLogMarkers;
 import org.apache.dolphinscheduler.task.executor.ITaskExecutor;
 import org.apache.dolphinscheduler.task.executor.ITaskExecutorRepository;
 import 
org.apache.dolphinscheduler.task.executor.events.AbstractTaskExecutorLifecycleEvent;
@@ -187,9 +188,9 @@ public class TaskExecutorEventBusCoordinator implements 
ITaskExecutorEventBusCoo
                                     "Unsupported TaskExecutorLifecycleEvent: " 
+ taskExecutorLifecycleEvent);
                     }
                 }
-                log.info("Success fire {}: {} ",
+                log.info(TaskLogMarkers.excludeInTaskLog(), "Success fire {}: 
{} ",
                         taskExecutorLifecycleEvent.getClass().getSimpleName(),
-                        
JSONUtils.toPrettyJsonString(taskExecutorLifecycleEvent));
+                        JSONUtils.toJsonString(taskExecutorLifecycleEvent));
             } catch (Exception e) {
                 log.error("Fire TaskExecutorLifecycleEvent: {} error", 
taskExecutorLifecycleEvent, e);
             }
diff --git 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorLifecycleEventRemoteReporter.java
 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorLifecycleEventRemoteReporter.java
index d83de7f98d..14c8b73bb9 100644
--- 
a/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorLifecycleEventRemoteReporter.java
+++ 
b/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorLifecycleEventRemoteReporter.java
@@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.task.executor.eventbus;
 import org.apache.dolphinscheduler.common.exception.BaseException;
 import org.apache.dolphinscheduler.common.thread.BaseDaemonThread;
 import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.plugin.task.api.log.TaskLogMarkers;
 import org.apache.dolphinscheduler.task.executor.ITaskExecutor;
 import org.apache.dolphinscheduler.task.executor.ITaskExecutorRepository;
 import 
org.apache.dolphinscheduler.task.executor.events.IReportableTaskExecutorLifecycleEvent;
@@ -107,7 +108,8 @@ public class TaskExecutorLifecycleEventRemoteReporter 
extends BaseDaemonThread
     public void reportTaskExecutorLifecycleEvent(final 
IReportableTaskExecutorLifecycleEvent reportableTaskExecutorLifecycleEvent) {
         eventChannelsLock.lock();
         try {
-            log.debug("Report : {}", 
JSONUtils.toPrettyJsonString(reportableTaskExecutorLifecycleEvent));
+            log.info(TaskLogMarkers.excludeInTaskLog(), "Report : {}",
+                    
JSONUtils.toPrettyJsonString(reportableTaskExecutorLifecycleEvent));
             int taskInstanceId = 
reportableTaskExecutorLifecycleEvent.getTaskInstanceId();
             eventChannels.computeIfAbsent(
                     taskInstanceId,
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskInstanceLogHeader.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskInstanceLogHeader.java
index 53e66da7d9..8e85832113 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskInstanceLogHeader.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskInstanceLogHeader.java
@@ -22,45 +22,17 @@ import lombok.extern.slf4j.Slf4j;
 @Slf4j
 public class TaskInstanceLogHeader {
 
-    private static final String INITIALIZE_TASK_CONTEXT_HEADER = new 
StringBuilder()
-            .append("\n")
-            
.append("************************************************************************************************")
-            .append("\n")
-            .append("*********************************  Initialize task 
context  ************************************")
-            .append("\n")
-            
.append("************************************************************************************************")
-            .toString();
-    private static final String LOAD_TASK_INSTANCE_PLUGIN_HEADER = new 
StringBuilder()
-            .append("\n")
-            
.append("***********************************************************************************************")
-            .append("\n")
-            .append("*********************************  Load task instance 
plugin  *********************************")
-            .append("\n")
-            
.append("***********************************************************************************************")
-            .toString();
+    public static final String DOLPHIN_EMOJI = "\uD83D\uDC2C";
+
+    private static final String INITIALIZE_TASK_CONTEXT_HEADER = DOLPHIN_EMOJI 
+ " Initialize Task Context";
+    private static final String LOAD_TASK_INSTANCE_PLUGIN_HEADER = 
DOLPHIN_EMOJI + " Load Task Instance Plugin";
+    private static final String EXECUTE_TASK_HEADER = DOLPHIN_EMOJI + " 
Execute Task Instance";
+    private static final String FINALIZE_TASK_HEADER = DOLPHIN_EMOJI + " 
Finalize Task Instance";
 
     public static void printInitializeTaskContextHeader() {
         log.info(INITIALIZE_TASK_CONTEXT_HEADER);
     }
 
-    private static final String EXECUTE_TASK_HEADER = new StringBuilder()
-            .append("\n")
-            
.append("************************************************************************************************")
-            .append("\n")
-            .append("*********************************  Execute task instance  
*************************************")
-            .append("\n")
-            
.append("***********************************************************************************************")
-            .toString();
-
-    private static final String FINALIZE_TASK_HEADER = new StringBuilder()
-            .append("\n")
-            
.append("************************************************************************************************")
-            .append("\n")
-            .append("*********************************  Finalize task instance 
 ************************************")
-            .append("\n")
-            
.append("***********************************************************************************************")
-            .toString();
-
     public static void printLoadTaskInstancePluginHeader() {
         log.info(LOAD_TASK_INSTANCE_PLUGIN_HEADER);
     }
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogDiscriminator.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogDiscriminator.java
index 3f16ee6a76..89a11e14fe 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogDiscriminator.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogDiscriminator.java
@@ -19,6 +19,8 @@ package org.apache.dolphinscheduler.plugin.task.api.log;
 
 import org.apache.dolphinscheduler.plugin.task.api.utils.LogUtils;
 
+import lombok.Getter;
+import lombok.Setter;
 import lombok.extern.slf4j.Slf4j;
 
 import org.slf4j.MDC;
@@ -30,6 +32,8 @@ import ch.qos.logback.core.sift.AbstractDiscriminator;
  * Task Log Discriminator
  */
 @Slf4j
+@Getter
+@Setter
 public class TaskLogDiscriminator extends AbstractDiscriminator<ILoggingEvent> 
{
 
     private String key;
@@ -44,26 +48,4 @@ public class TaskLogDiscriminator extends 
AbstractDiscriminator<ILoggingEvent> {
         }
         return taskInstanceLogPath;
     }
-
-    @Override
-    public void start() {
-        started = true;
-    }
-
-    @Override
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public String getLogBase() {
-        return logBase;
-    }
-
-    public void setLogBase(String logBase) {
-        this.logBase = logBase;
-    }
 }
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogFilter.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogFilter.java
index 8e71427559..6f9d9ec90b 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogFilter.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogFilter.java
@@ -19,9 +19,12 @@ package org.apache.dolphinscheduler.plugin.task.api.log;
 
 import org.apache.dolphinscheduler.plugin.task.api.utils.LogUtils;
 
+import org.apache.commons.lang3.StringUtils;
+
 import lombok.extern.slf4j.Slf4j;
 
 import org.slf4j.MDC;
+import org.slf4j.Marker;
 
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.core.filter.Filter;
@@ -35,6 +38,24 @@ public class TaskLogFilter extends Filter<ILoggingEvent> {
 
     @Override
     public FilterReply decide(ILoggingEvent event) {
-        return MDC.get(LogUtils.TASK_INSTANCE_LOG_FULL_PATH_MDC_KEY) == null ? 
FilterReply.DENY : FilterReply.ACCEPT;
+        String taskInstanceLogPath = 
MDC.get(LogUtils.TASK_INSTANCE_LOG_FULL_PATH_MDC_KEY);
+        // If the taskInstanceLogPath is empty, it means that the log is not 
related to a task instance.
+        if (StringUtils.isEmpty(taskInstanceLogPath)) {
+            return FilterReply.DENY;
+        }
+
+        // todo: Only when the master is includeInTaskLog, the log should be 
included in the task instance log, we can
+        // remove `excludeInTaskLog` after change the log in plugin
+        final Marker marker = event.getMarker();
+        if (marker == null) {
+            return FilterReply.ACCEPT;
+        }
+        if (marker.contains(TaskLogMarkers.includeInTaskLog())) {
+            return FilterReply.ACCEPT;
+        }
+        if (marker.contains(TaskLogMarkers.excludeInTaskLog())) {
+            return FilterReply.DENY;
+        }
+        return FilterReply.ACCEPT;
     }
 }
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogFilter.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogMarkers.java
similarity index 60%
copy from 
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogFilter.java
copy to 
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogMarkers.java
index 8e71427559..92276e3368 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogFilter.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/log/TaskLogMarkers.java
@@ -17,24 +17,24 @@
 
 package org.apache.dolphinscheduler.plugin.task.api.log;
 
-import org.apache.dolphinscheduler.plugin.task.api.utils.LogUtils;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
 
-import lombok.extern.slf4j.Slf4j;
+public class TaskLogMarkers {
 
-import org.slf4j.MDC;
+    private static final Marker TASK_LOGGER_EXCLUDE_MARKER = 
MarkerFactory.getMarker("TASK_LOGGER_EXCLUDE");
 
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.filter.Filter;
-import ch.qos.logback.core.spi.FilterReply;
+    private static final Marker TASK_LOGGER_INCLUDE_MARKER = 
MarkerFactory.getMarker("TASK_LOGGER_INCLUDE");
 
-/**
- * This class is used to filter the log of the task instance.
- */
-@Slf4j
-public class TaskLogFilter extends Filter<ILoggingEvent> {
+    /**
+     * The marker used to exclude logs from the task instance log file.
+     */
+    public static Marker excludeInTaskLog() {
+        return TASK_LOGGER_EXCLUDE_MARKER;
+    }
+
+    public static Marker includeInTaskLog() {
+        return TASK_LOGGER_INCLUDE_MARKER;
 
-    @Override
-    public FilterReply decide(ILoggingEvent event) {
-        return MDC.get(LogUtils.TASK_INSTANCE_LOG_FULL_PATH_MDC_KEY) == null ? 
FilterReply.DENY : FilterReply.ACCEPT;
     }
 }
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/shell/BaseLinuxShellInterceptorBuilder.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/shell/BaseLinuxShellInterceptorBuilder.java
index 6f02737dd8..58c51a5465 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/shell/BaseLinuxShellInterceptorBuilder.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/shell/BaseLinuxShellInterceptorBuilder.java
@@ -61,12 +61,8 @@ public abstract class BaseLinuxShellInterceptorBuilder<T 
extends BaseLinuxShellI
         Path shellAbsolutePath = shellAbsolutePath();
         FileUtils.createFileWith755(shellAbsolutePath);
         Files.write(shellAbsolutePath, finalScript.getBytes(), 
StandardOpenOption.APPEND);
-        log.info(
-                "Final Shell file is: \n****************************** Script 
Content *****************************************************************\n"
-                        +
-                        "{}" +
-                        "\n****************************** Script Content 
*****************************************************************\n",
-                finalScript);
+        log.info("Final Script 
Content:\n====================\n{}\n====================", finalScript);
+
     }
 
     protected List<String> generateBootstrapCommand() {
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/LogUtils.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/LogUtils.java
index 052519b07c..b251b33f65 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/LogUtils.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/LogUtils.java
@@ -57,7 +57,7 @@ import ch.qos.logback.core.spi.AppenderAttachable;
 @UtilityClass
 public class LogUtils {
 
-    private static Path TASK_INSTANCE_LOG_BASE_PATH = 
getTaskInstanceLogBasePath();
+    private static final Path TASK_INSTANCE_LOG_BASE_PATH = 
getTaskInstanceLogBasePath();
     public static final String TASK_INSTANCE_LOG_FULL_PATH_MDC_KEY = 
"taskInstanceLogFullPath";
 
     private static final Pattern APPLICATION_REGEX = 
Pattern.compile(TaskConstants.YARN_APPLICATION_REGEX);
diff --git 
a/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/executor/PhysicalTaskExecutor.java
 
b/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/executor/PhysicalTaskExecutor.java
index 6a018a1ad8..d6139b2019 100644
--- 
a/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/executor/PhysicalTaskExecutor.java
+++ 
b/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/executor/PhysicalTaskExecutor.java
@@ -21,6 +21,7 @@ import org.apache.dolphinscheduler.common.utils.JSONUtils;
 import org.apache.dolphinscheduler.plugin.storage.api.StorageOperator;
 import org.apache.dolphinscheduler.plugin.task.api.AbstractTask;
 import org.apache.dolphinscheduler.plugin.task.api.TaskCallBack;
+import org.apache.dolphinscheduler.plugin.task.api.log.TaskLogMarkers;
 import org.apache.dolphinscheduler.plugin.task.api.model.ApplicationInfo;
 import org.apache.dolphinscheduler.plugin.task.api.resource.ResourceContext;
 import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
@@ -122,7 +123,9 @@ public class PhysicalTaskExecutor extends 
AbstractTaskExecutor {
         taskExecutionContext.setResourceContext(resourceContext);
         log.info("Download resources successfully: \n{}", 
taskExecutionContext.getResourceContext());
 
-        log.info("End initialize task {}", 
JSONUtils.toPrettyJsonString(taskExecutionContext));
+        log.info(TaskLogMarkers.excludeInTaskLog(), "Initialized Task 
Context{}",
+                JSONUtils.toPrettyJsonString(taskExecutionContext));
+
     }
 
     @Override
diff --git a/dolphinscheduler-worker/src/main/resources/logback-spring.xml 
b/dolphinscheduler-worker/src/main/resources/logback-spring.xml
index fe99943fad..762076c03c 100644
--- a/dolphinscheduler-worker/src/main/resources/logback-spring.xml
+++ b/dolphinscheduler-worker/src/main/resources/logback-spring.xml
@@ -43,7 +43,7 @@
                 <file>${taskInstanceLogFullPath}</file>
                 <encoder>
                     <pattern>
-                        %date{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] - 
%message%n
+                        %date{yyyy-MM-dd HH:mm:ss.SSS} %-5level - %message%n
                     </pattern>
                     <charset>UTF-8</charset>
                 </encoder>

Reply via email to