forked from byzer-org/byzer-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
181378a
commit 9d3bd19
Showing
6 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
streamingpro-mlsql/src/main/java/tech/mlsql/job/listeners/EngineMDCLogListener.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package tech.mlsql.job.listeners | ||
|
||
import org.slf4j.MDC | ||
import streaming.dsl.ScriptSQLExec | ||
import tech.mlsql.MLSQLEnvKey | ||
import tech.mlsql.job.JobListener | ||
|
||
/** | ||
* 2019-06-01 WilliamZhu([email protected]) | ||
*/ | ||
class EngineMDCLogListener extends JobListener { | ||
override def onJobStarted(event: JobListener.JobStartedEvent): Unit = { | ||
val context = ScriptSQLExec.contextGetOrForTest() | ||
val items = context.userDefinedParam | ||
if (items.getOrElse(MLSQLEnvKey.REQUEST_CONTEXT_ENABLE_SPARK_LOG, "false").toBoolean) { | ||
MDC.put("owner", s"[owner] [${context.owner}]") | ||
} | ||
|
||
} | ||
|
||
override def onJobFinished(event: JobListener.JobFinishedEvent): Unit = { | ||
val context = ScriptSQLExec.contextGetOrForTest() | ||
val items = context.userDefinedParam | ||
if (items.getOrElse(MLSQLEnvKey.REQUEST_CONTEXT_ENABLE_SPARK_LOG, "false").toBoolean) { | ||
MDC.remove("owner") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters