From 25be5539fc541867b970201d80a27c458f023e15 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 14 Oct 2014 17:28:43 +0300 Subject: [PATCH] Read both stdoud and stderr for logging. --- .../syncthingandroid/syncthing/SyncthingRunnable.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java index 099e6dee..33e2383b 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java @@ -61,7 +61,8 @@ public class SyncthingRunnable implements Runnable { dos.writeBytes("exit\n"); dos.flush(); - log(process.getInputStream()); + log(process.getInputStream(), Log.INFO); + log(process.getErrorStream(), Log.WARN); ret = process.waitFor(); } while (ret == 3); @@ -98,7 +99,7 @@ public class SyncthingRunnable implements Runnable { * * @param is The stream to log. */ - private void log(final InputStream is) { + private void log(final InputStream is, final int priority) { new Thread(new Runnable() { @Override public void run() { @@ -107,7 +108,7 @@ public class SyncthingRunnable implements Runnable { String line; try { while ((line = br.readLine()) != null) { - Log.i(TAG_NATIVE, line); + Log.println(priority, TAG_NATIVE, line); } } catch (IOException e) { // NOTE: This is sometimes called on shutdown, as