gengliangwang commented on code in PR #47732:
URL: https://github.com/apache/spark/pull/47732#discussion_r1715717587
##########
common/utils/src/main/scala/org/apache/spark/internal/Logging.scala:
##########
@@ -165,7 +165,13 @@ trait Logging {
}
protected def withLogContext(context: java.util.HashMap[String,
String])(body: => Unit): Unit = {
- val threadContext = CloseableThreadContext.putAll(context)
+ // put into thread context only when structured logging is enabled
+ val updatedContext = if (Logging.isStructuredLoggingEnabled) {
+ context
+ } else {
+ new java.util.HashMap[String, String]()
Review Comment:
nit: shall we keep this to a val in object `Logging` instead of creating a
new one for each log entry?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]