breakdawn commented on a change in pull request #24684: [SPARK-27657][ML]Fix 
the log format of ml.util.Instrumentation.logFai…
URL: https://github.com/apache/spark/pull/24684#discussion_r287660742
 
 

 ##########
 File path: mllib/src/main/scala/org/apache/spark/ml/util/Instrumentation.scala
 ##########
 @@ -161,8 +162,9 @@ private[spark] class Instrumentation private () extends 
Logging with MLEvents {
    * Logs an exception raised during a training session.
    */
   def logFailure(e: Throwable): Unit = {
-    val msg = e.getStackTrace.mkString("\n")
-    super.logError(msg)
+    val msg = new StringWriter()
+    e.printStackTrace(new PrintWriter(msg))
+    super.logError(msg.toString)
 
 Review comment:
   The original log loses the error message, in this example, it's the line 
'java.lang.RuntimeException: Failed to finish the task'
   
   And it loses suppressed and cause of the exception too, in this case, it's 
the lines 
   'Caused by: java.io.FileNotFoundException: File is not found
   at com.xxx.Test.test(Test.java:105)
   ...'

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to