From a1f60aab91168a8dca48f2b2b18cdc1e28c0b03e Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Sat, 25 Jul 2015 00:07:33 +0200 Subject: [PATCH] Fix logging configuration Make sure to not invoke any logging before it is properly configured. --- .../nodomain/freeyourgadget/gadgetbridge/GBApplication.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 9bf18f1b..8b67a2bd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -23,13 +23,15 @@ public class GBApplication extends Application { public GBApplication() { context = this; - mActivityDatabaseHandler = new ActivityDatabaseHandler(context); + // don't do anything here, add it to onCreate instead } @Override public void onCreate() { super.onCreate(); + // don't do anything here before we set up logging, otherwise + // slf4j may be implicitly initialized before we properly configured it. setupLogging(); // For debugging problems with the logback configuration // LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); @@ -37,6 +39,7 @@ public class GBApplication extends Application { // StatusPrinter.print(lc); // Logger logger = LoggerFactory.getLogger(GBApplication.class); + mActivityDatabaseHandler = new ActivityDatabaseHandler(context); // for testing DB stuff // SQLiteDatabase db = mActivityDatabaseHandler.getWritableDatabase(); // db.close();