From 3acc05b605db75ff985fed7a58413b286325411b Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Tue, 4 Oct 2016 22:41:52 +0200 Subject: [PATCH] Enable verbose logging of allow loggers (for instance, okhttp) / dav4android update --- .../main/java/at/bitfire/davdroid/App.java | 20 +++++++++---------- dav4android | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/at/bitfire/davdroid/App.java b/app/src/main/java/at/bitfire/davdroid/App.java index 7917b6b6..da2364bd 100644 --- a/app/src/main/java/at/bitfire/davdroid/App.java +++ b/app/src/main/java/at/bitfire/davdroid/App.java @@ -17,6 +17,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Build; +import android.os.Process; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.NotificationManagerCompat; @@ -87,9 +88,6 @@ public class App extends Application { } public void reinitLogger() { - // don't use Android default logging, we have our own handlers - log.setUseParentHandlers(false); - @Cleanup ServiceDB.OpenHelper dbHelper = new ServiceDB.OpenHelper(this); Settings settings = new Settings(dbHelper.getReadableDatabase()); @@ -97,14 +95,14 @@ public class App extends Application { logVerbose = logToFile || Log.isLoggable(log.getName(), Log.DEBUG); // set logging level according to preferences - log.setLevel(logVerbose ? Level.ALL : Level.INFO); + final Logger rootLogger = Logger.getLogger(""); + rootLogger.setLevel(logVerbose ? Level.ALL : Level.INFO); - // remove all handlers - for (Handler handler : log.getHandlers()) - log.removeHandler(handler); - - // add logcat handler - log.addHandler(LogcatHandler.INSTANCE); + // remove all handlers and add our own logcat handler + rootLogger.setUseParentHandlers(false); + for (Handler handler : rootLogger.getHandlers()) + rootLogger.removeHandler(handler); + rootLogger.addHandler(LogcatHandler.INSTANCE); NotificationManagerCompat nm = NotificationManagerCompat.from(this); // log to external file according to preferences @@ -118,7 +116,7 @@ public class App extends Application { File dir = getExternalFilesDir(null); if (dir != null) try { - String fileName = new File(dir, "davdroid-" + android.os.Process.myPid() + "-" + + String fileName = new File(dir, "davdroid-" + Process.myPid() + "-" + DateFormatUtils.format(System.currentTimeMillis(), "yyyyMMdd-HHmmss") + ".txt").toString(); log.info("Logging to " + fileName); diff --git a/dav4android b/dav4android index e70f7a41..9a334f69 160000 --- a/dav4android +++ b/dav4android @@ -1 +1 @@ -Subproject commit e70f7a4135b124af9fd696f6863c50ea4c91562f +Subproject commit 9a334f69c781be37bd26eca3f18734c5f6826a8e