1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 19:31:30 +00:00

Read both stdoud and stderr for logging.

This commit is contained in:
Felix Ableitner 2014-10-14 17:28:43 +03:00
parent e7cc3b1a10
commit 25be5539fc

View file

@ -61,7 +61,8 @@ public class SyncthingRunnable implements Runnable {
dos.writeBytes("exit\n"); dos.writeBytes("exit\n");
dos.flush(); dos.flush();
log(process.getInputStream()); log(process.getInputStream(), Log.INFO);
log(process.getErrorStream(), Log.WARN);
ret = process.waitFor(); ret = process.waitFor();
} while (ret == 3); } while (ret == 3);
@ -98,7 +99,7 @@ public class SyncthingRunnable implements Runnable {
* *
* @param is The stream to log. * @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() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -107,7 +108,7 @@ public class SyncthingRunnable implements Runnable {
String line; String line;
try { try {
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
Log.i(TAG_NATIVE, line); Log.println(priority, TAG_NATIVE, line);
} }
} catch (IOException e) { } catch (IOException e) {
// NOTE: This is sometimes called on shutdown, as // NOTE: This is sometimes called on shutdown, as