LuciferYang commented on code in PR #46193:
URL: https://github.com/apache/spark/pull/46193#discussion_r1578922427
##########
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:
> If necessary in the future, I think it would be easier to implement based
on the `current changes`, such as
>
> * `ILogKey`
> * `InternalLogKey` extends `ILogKey`
> * `LogKey` extends `InternalLogKey`
> * `ExternalLogKey` extends `ILogKey`
> * `ThirdPartyLogKey` extends `ExternalLogKey`
Yes, we can further expand after this PR is completed.
Personally, I think we can add a String field to the MDC to identify the
namespace. For example, the namespace of Spark's internal MDC can always be
`SPARK`, and the third-party Spark ecosystem can customize their own namespace.
This can make the key of `MessageWithContext` become similar to `SPARK.mdcKey`,
`CUSTOM_NAMESPACE.mdcKey`.
Perhaps this is not a perfect method, we can further discuss it after this
PR is completed.
--
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]