0

我已經使用首選項 - >編輯器 - >顏色&字體 - > Android Logcat設置了我的LogCat級別,但突然間,當我做Log.wtf()時,它顯示的樣式設置爲Error級別,而不是像以前一樣是AssertLog.wtf()在Android Studio 2.0中顯示爲Log.e()?

+1

只是好奇,想定位您的應用不能:/爲什麼有關係嗎! –

+0

因爲它可以更容易地發現某些日誌輸出,如果它們看起來都一樣。特別是因爲Android Studio Logcat不會將輸出格式化爲像Eclipse一樣的列... – BadCash

回答

3

在API 23上,Log.wtf()不再創建日誌ASSERT級別,而是ERROR級別。

然而,人們仍然可以通過使用

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

在API 23

+0

Downvoter,關心激勵? – BadCash

0

框架球隊拿到了ASSERT級風格降級從聲明WTF(多麼可怕的失敗)錯誤

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

在android studio 2.0中,它的工作原理是「按照預期」。

如果你想看到WTF日誌顯示廣告斷言,舊的設備上運行的應用程序(API < < 23)

也嘗試過阿比19