public static void startLogging(final Looper looper) {
        final LooperLogger ll = new LooperLogger();
        looper.setMessageLogging(ll::process);
        looper.getThread().getStackTrace();
        AndroidRxUtils.runPeriodically(AndroidRxUtils.computationScheduler, () -> {
            if (!ll.collectTraces.get()) {
                return;
            }
            synchronized (ll.collectedInfos) {
                ll.collectedInfos.add(
                        DATE_FORMATTER.format(new Date(System.currentTimeMillis())) + "/" + looper.getThread().getState() + ": " +
                                Log.stackTraceToShortString(looper.getThread().getStackTrace(), 0, null));
            }
        }, 0, 200);
        Log.iForce("LooperLogger: started for Thread: " + looper.getThread().getName());
    }
Helper class, gaining and logging statistics about a looper
main/src/main/java/cgeo/geocaching/LooperLogger.java