Skip to content

Commit

Permalink
update log of match error code to error level
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Sep 19, 2023
1 parent 2503979 commit ae2f45d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object LogUtils {
}

def generateERROR(rawLog: String): String = {
getTimeFormat + " " + "ERROR" + " " + rawLog
getTimeFormat + " " + ERROR_STR + " " + rawLog
}

def generateWarn(rawLog: String): String = {
Expand All @@ -52,4 +52,7 @@ object LogUtils {
getTimeFormat + " " + "SYSTEM-WARN" + " " + rawLog
}

val ERROR_STR = "ERROR"


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.linkis.entrance.log

import org.apache.linkis.common.log.LogUtils
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.entrance.EntranceContext
import org.apache.linkis.entrance.job.EntranceExecutionJob
Expand Down Expand Up @@ -59,10 +60,19 @@ abstract class LogManager extends LogListener with Logging {
}
}
}
entranceExecutionJob.getLogWriter.foreach(logWriter => logWriter.write(log))
errorCodeManager.foreach(_.errorMatch(log).foreach { case (code, errorMsg) =>
errorCodeListener.foreach(_.onErrorCodeCreated(job, code, errorMsg))
var writeLog = log
errorCodeManager.foreach(_.errorMatch(log).foreach {
case (code, errorMsg) =>
if (!writeLog.contains(LogUtils.ERROR_STR)) {
writeLog = LogUtils.generateERROR(log + "\n") + LogUtils.generateERROR(
s"error code: $code, errorMsg: $errorMsg"
)
}
errorCodeListener.foreach(_.onErrorCodeCreated(job, code, errorMsg))
case _ =>
})
entranceExecutionJob.getLogWriter.foreach(logWriter => logWriter.write(writeLog))

case _ =>
}
} {
Expand Down

0 comments on commit ae2f45d

Please sign in to comment.