diff options
author | Tor Norbye <tnorbye@google.com> | 2012-01-11 17:26:46 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-01-12 13:37:04 -0800 |
commit | 963ce6c6e3ec495b3cbd8092da0dcd7df4006fdb (patch) | |
tree | b48c8b01d35b07b35ddf169fe0fe30736fb2a1e9 /ddms/libs | |
parent | 32777c7d98f1d212fbb29568286bdc48f831ca21 (diff) | |
download | sdk-963ce6c6e3ec495b3cbd8092da0dcd7df4006fdb.zip sdk-963ce6c6e3ec495b3cbd8092da0dcd7df4006fdb.tar.gz sdk-963ce6c6e3ec495b3cbd8092da0dcd7df4006fdb.tar.bz2 |
Improved ADB logging on failure to help pinpoint issues
Change-Id: Ic0bee3baf2c766b9c859ad6d93505bd1cfce0776
Diffstat (limited to 'ddms/libs')
-rw-r--r-- | ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java b/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java index 253f41f..15eb0dc 100644 --- a/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java +++ b/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java @@ -19,6 +19,7 @@ package com.android.ddmlib; import com.android.ddmlib.Log.LogLevel; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.lang.Thread.State; @@ -577,7 +578,7 @@ public final class AndroidDebugBridge { builder.append('\n'); builder.append(error); } - Log.logAndDisplay(LogLevel.ERROR, "adb", builder.toString()); + Log.logAndDisplay(LogLevel.ERROR, ADB, builder.toString()); } // check both stdout and stderr @@ -599,13 +600,25 @@ public final class AndroidDebugBridge { if (!versionFound) { // if we get here, we failed to parse the output. - Log.logAndDisplay(LogLevel.ERROR, ADB, - "Failed to parse the output of 'adb version'"); //$NON-NLS-1$ + StringBuilder builder = new StringBuilder( + "Failed to parse the output of 'adb version':\n"); //$NON-NLS-1$ + builder.append("Standard Output was:\n"); //$NON-NLS-1$ + for (String line : stdOutput) { + builder.append(line); + builder.append('\n'); + } + builder.append("\nError Output was:\n"); //$NON-NLS-1$ + for (String line : errorOutput) { + builder.append(line); + builder.append('\n'); + } + Log.logAndDisplay(LogLevel.ERROR, ADB, builder.toString()); } - } catch (IOException e) { Log.logAndDisplay(LogLevel.ERROR, ADB, - "Failed to get the adb version: " + e.getMessage()); //$NON-NLS-1$ + "Failed to get the adb version: " + e.getMessage() //$NON-NLS-1$ + + " from '" + mAdbOsLocation + "' - exists=" //$NON-NLS-1$ + + (new File(mAdbOsLocation).exists())); } catch (InterruptedException e) { } finally { |