Re: [PR] [WIP][SPARK-47594] Connector module: Migrate logInfo with variables to structured logging framework [spark]

2024-04-15 Thread via GitHub


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


##
connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala:
##
@@ -70,7 +70,7 @@ class KafkaTestUtils(
   private val JAVA_AUTH_CONFIG = "java.security.auth.login.config"
 
   private val localHostNameForURI = Utils.localHostNameForURI()
-  logInfo(s"Local host name is $localHostNameForURI")
+  logInfo(log"Local host name is ${MDC(LogKey.URI, localHostNameForURI)}")

Review Comment:
   Because the LogKey `URI` is duplicated with the J`ava class`, we will write 
it directly as `LogKey.XXX`
   At the same time, we will delete the import 
   ```
   import org.apache.spark.internal.LogKey.ERROR
   ```



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



Re: [PR] [WIP][SPARK-47594] Connector module: Migrate logInfo with variables to structured logging framework [spark]

2024-04-15 Thread via GitHub


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


##
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectServer.scala:
##
@@ -38,8 +39,8 @@ object SparkConnectServer extends Logging {
 SparkConnectService.server.getListenSockets.asScala.foreach { sa =>
   val isa = sa.asInstanceOf[InetSocketAddress]
   logInfo(
-s"Spark Connect server started at: " +
-  s"${isa.getAddress.getHostAddress}:${isa.getPort}")
+log"Spark Connect server started at: " +
+  log"${MDC(RPC_ADDRESS, 
isa.getAddress.getHostAddress)}:${MDC(PORT, isa.getPort)}")

Review Comment:
   I'm not sure if calling it `HOST_PORT` would be more appropriate.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org