diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java index 1729736c..e618b1a8 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java @@ -132,7 +132,7 @@ public class LogActivity extends SyncthingActivity { if (syncthingLog) { pb = new ProcessBuilder("/system/bin/logcat", "-t", "300", "-v", "raw", "-s", "SyncthingNativeCode"); } else { - pb = new ProcessBuilder("/system/bin/logcat", "-t", "300", "-v", "time", "'*'"); + pb = new ProcessBuilder("/system/bin/logcat", "-t", "300", "-v", "time", "*:i ps:s art:s"); } pb.redirectErrorStream(true); process = pb.start(); diff --git a/src/main/java/com/nutomic/syncthingandroid/http/ApiRequest.java b/src/main/java/com/nutomic/syncthingandroid/http/ApiRequest.java index a3dfec2e..315e47bb 100644 --- a/src/main/java/com/nutomic/syncthingandroid/http/ApiRequest.java +++ b/src/main/java/com/nutomic/syncthingandroid/http/ApiRequest.java @@ -100,8 +100,8 @@ public abstract class ApiRequest { }, error -> { if (errorListener != null) errorListener.onError(error); - - Log.w(TAG, "Request to " + uri + " failed: " + error.getMessage()); + else + Log.w(TAG, "Request to " + uri + " failed", error); }) { @Override public Map getHeaders() throws AuthFailureError { diff --git a/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java b/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java index ac80f850..814e4d53 100644 --- a/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/http/PollWebGuiAvailableTask.java @@ -4,10 +4,12 @@ package com.nutomic.syncthingandroid.http; import android.content.Context; import android.net.Uri; import android.os.Handler; +import android.util.Log; import com.android.volley.Request; import com.android.volley.VolleyError; +import java.net.ConnectException; import java.net.URL; import java.util.Collections; @@ -16,6 +18,7 @@ import java.util.Collections; */ public class PollWebGuiAvailableTask extends ApiRequest { + private static final String TAG = "PollWebGuiAvailableTask"; /** * Interval in ms, at which connections to the web gui are performed on first start * to find out if it's online. @@ -28,6 +31,7 @@ public class PollWebGuiAvailableTask extends ApiRequest { public PollWebGuiAvailableTask(Context context, URL url, String apiKey, OnSuccessListener listener) { super(context, url, "", apiKey); + Log.i(TAG, "Starting to poll for web gui availability"); mListener = listener; performRequest(); } @@ -39,6 +43,13 @@ public class PollWebGuiAvailableTask extends ApiRequest { private void onError(VolleyError error) { mHandler.postDelayed(this::performRequest, WEB_GUI_POLL_INTERVAL); + + Throwable cause = error.getCause(); + if (cause == null || cause.getClass().equals(ConnectException.class)) { + Log.v(TAG, "Polling web gui"); + } else { + Log.w(TAG, "Unexpected error while polling web gui", error); + } } } diff --git a/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java b/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java index dd4b9cbf..fa4fddf3 100644 --- a/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java +++ b/src/main/java/com/nutomic/syncthingandroid/service/EventProcessor.java @@ -154,7 +154,7 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene // Ignored. break; default: - Log.i(TAG, "Unhandled event " + event.type); + Log.v(TAG, "Unhandled event " + event.type); } } diff --git a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingRunnable.java b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingRunnable.java index dd50997a..a91d303e 100644 --- a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingRunnable.java +++ b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingRunnable.java @@ -120,6 +120,7 @@ public class SyncthingRunnable implements Runnable { niceSyncthing(); ret = process.waitFor(); + Log.i(TAG, "Syncthing exited with code " + ret); mSyncthing.set(null); lInfo.join(); lWarn.join(); diff --git a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java index bbb1ee34..880f990a 100644 --- a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java @@ -306,6 +306,7 @@ public class SyncthingService extends Service implements * Sets {@link #mCurrentState} to newState, and calls onKilledListener once Syncthing is killed. */ private void shutdown(State newState, SyncthingRunnable.OnSyncthingKilled onKilledListener) { + Log.i(TAG, "Shutting down background service"); onApiChange(newState); if (mEventProcessor != null) diff --git a/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java b/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java index 6404efa5..b0581298 100644 --- a/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java +++ b/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java @@ -79,6 +79,7 @@ public class ConfigXml { Log.w(TAG, "Cannot read '" + mConfigFile + "'", e); throw new OpenConfigException(); } + Log.i(TAG, "Loaded Syncthing config file"); } private void generateKeysConfig(Context context) { diff --git a/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java b/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java index 53096339..2034603d 100644 --- a/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java +++ b/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java @@ -31,6 +31,7 @@ public class FolderObserver extends FileObserver { public FolderObserver(OnFolderFileChangeListener listener, Folder folder) throws FolderNotExistingException { this(listener, folder, ""); + Log.i(TAG, "Observer created for (folder " + folder.id + ")"); } public class FolderNotExistingException extends Exception { @@ -62,7 +63,7 @@ public class FolderObserver extends FileObserver { mListener = listener; mFolder = folder; mPath = path; - Log.v(TAG, "observer created for " + new File(mFolder.path, mPath).toString() + " (folder " + folder.id + ")"); + Log.v(TAG, "Observer created for " + new File(mFolder.path, mPath).toString() + " (folder " + folder.id + ")"); startWatching(); File currentFolder = new File(folder.path, path); diff --git a/src/main/res/menu/log_list.xml b/src/main/res/menu/log_list.xml index 2119e917..f2a94246 100644 --- a/src/main/res/menu/log_list.xml +++ b/src/main/res/menu/log_list.xml @@ -5,13 +5,11 @@ + android:title="@string/view_android_log" /> + app:actionProviderClass="android.support.v7.widget.ShareActionProvider" />