panbingkun commented on code in PR #46193:
URL: https://github.com/apache/spark/pull/46193#discussion_r1577397848


##########
common/utils/src/test/scala/org/apache/spark/util/StructuredLoggingSuite.scala:
##########
@@ -144,6 +146,22 @@ trait LoggingSuiteBase
       }
   }
 
+  // An enumeration value that is not defined in `LogKey`, you can define it 
anywhere
+  private val externalLogKey = LogKey.VALUE
+  private val externalLog = log"${MDC(externalLogKey, "External log 
message.")}"
+  test("Logging with external LogKey") {

Review Comment:
   @LuciferYang @gengliangwang 
   I have updated a version that removes `enumeration`. When using structured 
logging mechanisms in external Spark related ecosystems, the following format 
can be used:
   ```
   case object CUSTOME_LOG_KEY extends ILogKey
   ```
   At present, this form is more in line with the traditional Spark style, and 
we can `constrain` the `class` of MDC parameter `key`



-- 
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]

Reply via email to