0

I have styled my LogCat levels using Preferences -> Editor -> Colors & fonts -> Android Logcat, but all of a sudden when I do Log.wtf() it displays with the style set for the Error level, not Assert like it used to be?

Magnus
  • 17,157
  • 19
  • 104
  • 189
  • 1
    Just curious :/ why does it matter! – Rachit Mishra Apr 17 '16 at 13:33
  • Because it makes it way easier to spot certain log outputs than if they all look the same. Especially since Android Studio Logcat doesn't format the output into columns like Eclipse used to do... – Magnus Apr 17 '16 at 13:37

2 Answers2

4

On API 23, Log.wtf() no longer creates a log of ASSERT level, but rather ERROR level.

However, one can still get the style for the ASSERT level by using

Log.println(Log.ASSERT, "TAG", "Message");

on API 23.

Magnus
  • 17,157
  • 19
  • 104
  • 189
0

The framework team downgraded WTF ( What a Terrible Failure ) from an Assert to an Error

 static int wtf(int logId, String tag, String msg, Throwable tr, boolean localStack,
        boolean system) {
    TerribleFailure what = new TerribleFailure(msg, tr);
    // Only mark this as ERROR, do not use ASSERT since that should be
    // reserved for cases where the system is guaranteed to abort.
    // The onTerribleFailure call does not always cause a crash.
    int bytes = println_native(logId, ERROR, tag, msg + '\n'
            + getStackTraceString(localStack ? what : tr));
    sWtfHandler.onTerribleFailure(tag, what, system);
    return bytes;
}

link

In android studio 2.0 it works "as Intended".

If you want to see WTF logs showed ad assert, run your application on an older device (Api << 23)

Try also to target your app not over Api 19

Community
  • 1
  • 1
ArghArgh
  • 356
  • 3
  • 27