Android Log,androidlog

來源:互聯網
上載者:User

Android Log,androidlog
1、Android Log簡介;

  在程式中輸出日誌,使用 android.util.Log 類。該類提供了若干靜態方法:

  Log.v(String tag, String msg);   // 任何訊息都會輸出
  Log.d(String tag, String msg);   // 僅輸出debug調試的意思,但他會輸出上層的資訊
  Log.i(String tag, String msg);    // 一般提示性的訊息information
  Log.w(String tag, String msg);    // warning
  Log.e(String tag, String msg);   // error

  層級由低到高,分別對應 Verbose、Debug、Info、Warning、Error。tag是一個標識、作為篩選條件。

2、如何查看Log;  (1) ADB命令(需先配置ADB環境)

    (1)adb logcat :查看所有Log

    (2)adb logcat -s MyTag:I     MyTag為你所設定的tag,會輸出 I 層級以上的日誌;

    (3)停止命令列:ctrl+c    

    (4)詳情可參考http://blog.csdn.net/tumuzhuanjia/article/details/39555445

  (2) Android Monitor(Android Studio 展示)                 

    可以按關鍵字完全符合過濾,也可以按Regex(Regex)過濾。

3、Live Template

    

    配置Template,再調試Log很方便嘍。

 

  轉載請註明出處:http://www.cnblogs.com/xsp0303/p/androidLog.html

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.