mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Enable verbose logging of allow loggers (for instance, okhttp) / dav4android update
This commit is contained in:
parent
3813c1e0c8
commit
3acc05b605
@ -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);
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e70f7a4135b124af9fd696f6863c50ea4c91562f
|
||||
Subproject commit 9a334f69c781be37bd26eca3f18734c5f6826a8e
|
Loading…
Reference in New Issue
Block a user