From 94a1a735b02fcf48a7bfd497b56e014e340abe46 Mon Sep 17 00:00:00 2001 From: taoran1250 <543121890@qq.com> Date: Wed, 18 Dec 2024 14:23:29 +0800 Subject: [PATCH] feat: Change the ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_ENABLED configuration to be obtained at runtime --- .../execute/EngineExecutionContext.scala | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/EngineExecutionContext.scala b/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/EngineExecutionContext.scala index 12faef2f0e..bd3faa8bb4 100644 --- a/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/EngineExecutionContext.scala +++ b/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/EngineExecutionContext.scala @@ -192,17 +192,19 @@ class EngineExecutionContext(executor: ComputationExecutor, executorUser: String } else { var taskLog = log val limitLength = ComputationExecutorConf.ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_LENGTH.getValue - if ( - ComputationExecutorConf.ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_ENABLED.getValue( - EngineConnObject.getEngineCreationContext.getOptions - ) && - log.length > limitLength - ) { - taskLog = s"${log.substring(0, limitLength)}..." - logger.info("The log is too long and will be intercepted,log limit length : {}", limitLength) + val limitEnableObj = properties.get(ComputationExecutorConf.ENGINE_SEND_LOG_TO_ENTRANCE_LIMIT_ENABLED.key) + val limitEnable = if (limitEnableObj == null) false else limitEnableObj.toString.toBoolean + if (limitEnable) { + if (log.length > limitLength) { + taskLog = s"${log.substring(0, limitLength)}..." + logger.info("The log is too long and will be intercepted,log limit length : {}", limitLength) + } } if (!AccessibleExecutorConfiguration.ENGINECONN_SUPPORT_PARALLELISM.getValue) { - LogHelper.cacheLog(taskLog) + val taskLogs = taskLog.split("\n") + taskLogs.foreach(line => { + LogHelper.cacheLog(line) + }) } else { val listenerBus = getEngineSyncListenerBus getJobId.foreach(jId => listenerBus.postToAll(TaskLogUpdateEvent(jId, taskLog)))