Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update log of match error code to error level #296

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading