Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline logging when there is a failure #439

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/csharp/Microsoft.Spark/Interop/Ipc/JvmBridge.cs
Original file line number Diff line number Diff line change
@@ -244,9 +244,9 @@ private string BuildErrorMessage(
object[] args)
{
var errorMessage = new StringBuilder("JVM method execution failed: ");
const string ConstructorFormat = "Constructor failed for class {0}";
const string StaticMethodFormat = "Static method {0} failed for class {1}";
const string NonStaticMethodFormat = "Nonstatic method {0} failed for class {1}";
const string ConstructorFormat = "Constructor failed for class '{0}'";
const string StaticMethodFormat = "Static method '{0}' failed for class '{1}'";
const string NonStaticMethodFormat = "Nonstatic method '{0}' failed for class '{1}'";

try
{
Original file line number Diff line number Diff line change
@@ -185,21 +185,21 @@ class DotnetBackendHandler(server: DotnetBackend)
case Some(jObj) => jObj.getClass.getName
case None => "NullObject"
}
logError(s"On object of type $jvmObjName failed", e)
val argsStr = args.map(arg => {
if (arg != null) {
s"[Type=${arg.getClass.getCanonicalName}, Value: $arg]"
} else {
"[Value: NULL]"
}
}).mkString(", ")

logError(s"Failed to execute '$methodName' on '$jvmObjName' with args=($argsStr)")

if (methods != null) {
logError("methods:")
methods.foreach(m => logError(m.toString))
}
if (args != null) {
logError("args:")
args.foreach(arg => {
if (arg != null) {
logError(s"argType: ${arg.getClass.getCanonicalName}, argValue: $arg")
} else {
logError("arg: NULL")
}
})
logDebug(s"All methods for $jvmObjName:")
methods.foreach(m => logDebug(m.toString))
}

writeInt(dos, -1)
writeString(dos, Utils.exceptionString(e.getCause))
}
Original file line number Diff line number Diff line change
@@ -185,21 +185,21 @@ class DotnetBackendHandler(server: DotnetBackend)
case Some(jObj) => jObj.getClass.getName
case None => "NullObject"
}
logError(s"On object of type $jvmObjName failed", e)
val argsStr = args.map(arg => {
if (arg != null) {
s"[Type=${arg.getClass.getCanonicalName}, Value: $arg]"
} else {
"[Value: NULL]"
}
}).mkString(", ")

logError(s"Failed to execute '$methodName' on '$jvmObjName' with args=($argsStr)")

if (methods != null) {
logError("methods:")
methods.foreach(m => logError(m.toString))
}
if (args != null) {
logError("args:")
args.foreach(arg => {
if (arg != null) {
logError(s"argType: ${arg.getClass.getCanonicalName}, argValue: $arg")
} else {
logError("arg: NULL")
}
})
logDebug(s"All methods for $jvmObjName:")
methods.foreach(m => logDebug(m.toString))
}

writeInt(dos, -1)
writeString(dos, Utils.exceptionString(e.getCause))
}
Original file line number Diff line number Diff line change
@@ -185,21 +185,21 @@ class DotnetBackendHandler(server: DotnetBackend)
case Some(jObj) => jObj.getClass.getName
case None => "NullObject"
}
logError(s"On object of type $jvmObjName failed", e)
val argsStr = args.map(arg => {
if (arg != null) {
s"[Type=${arg.getClass.getCanonicalName}, Value: $arg]"
} else {
"[Value: NULL]"
}
}).mkString(", ")

logError(s"Failed to execute '$methodName' on '$jvmObjName' with args=($argsStr)")

if (methods != null) {
logError("methods:")
methods.foreach(m => logError(m.toString))
}
if (args != null) {
logError("args:")
args.foreach(arg => {
if (arg != null) {
logError(s"argType: ${arg.getClass.getCanonicalName}, argValue: $arg")
} else {
logError("arg: NULL")
}
})
logDebug(s"All methods for $jvmObjName:")
methods.foreach(m => logDebug(m.toString))
}

writeInt(dos, -1)
writeString(dos, Utils.exceptionString(e.getCause))
}