vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579629130


##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
     if (isDebug) {
       builder.redirectError(Redirect.INHERIT)
       builder.redirectOutput(Redirect.INHERIT)
-    } else {
-      // If output is not consumed, the stdout/stderr pipe buffers will fill 
up,
-      // causing the server process to block on write() calls
-      builder.redirectError(Redirect.DISCARD)
-      builder.redirectOutput(Redirect.DISCARD)
     }
 
     val process = builder.start()
     consoleOut = process.getOutputStream
 
+    if (!isDebug) {
+      // Redirect stdout and stderr to log files.
+      // If output is not consumed, the stdout/stderr pipe buffers will fill 
up,
+      // causing the server process to block on write() calls.
+      val targetDir = new File(s"$connectClientHomeDir/target")
+      targetDir.mkdirs()
+      val timestamp = System.currentTimeMillis()
+      val stdoutLogFile = new File(targetDir, 
s"spark-connect-test-server-stdout-$timestamp.log")
+      val stderrLogFile = new File(targetDir, 
s"spark-connect-test-server-stderr-$timestamp.log")

Review Comment:
   >are them in the same directory as the log4j files? 
   
   No, not in the same directory as the log4j files.
   Reason: When SPARK_DEBUG_SC_JVM_CLIENT=false, log4j configuration is not 
passed to the server 
   
   When 
   `SPARK_DEBUG_SC_JVM_CLIENT=true  build/sbt "connect-client-jdbc/testOnly 
org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`
   
   >what's the name of log4j file: 
   
   ./target/unit-tests.log
   
   When 
   `SPARK_DEBUG_SC_JVM_CLIENT=false  build/sbt "connect-client-jdbc/testOnly 
org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`
   
   >what's the name of log4j file: 
   
   No log4j file is generated. log4j configuration is not passed to the server 
   So, we redirect the stdout/stderr to 
   ```
   
./sql/connect/client/jvm/target/spark-connect-test-server-stderr-<timestamp>.log
   
./sql/connect/client/jvm/target/spark-connect-test-server-stdout-<timestamp>.log
   ```
   
   Please refer this comment :  
https://github.com/apache/spark/pull/53261#discussion_r2579619880



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