當前位置:首頁 » 安卓系統 » android查看log

android查看log

發布時間: 2022-05-22 19:36:20

㈠ 如何查看android客戶端軟體log

在程序中輸出日誌, 使用 android.util.Log 類.

該類提供了若干靜態方法


Log.v(String tag, String msg);

Log.d(String tag, String msg);

Log.i(String tag, String msg);

Log.w(String tag, String msg);

Log.e(String tag, String msg);


分別對應 Verbose, Debug, Info, Warning,Error.


tag是一個標識,可以是任意字元串,通常可以使用類名+方法名, 主要是用來在查看日誌時提供一個篩選條件.


程序運行後 並不會在 ide的控制台內輸出任何信息.


如果要後查看日誌 請使用


adb logcat


關於adb的更多信息請查看官方網站.


當執行 adb logcat 後會以tail方式實時顯示出所有的日誌信息.


這時候我們通常需要對信息進行過濾,來顯示我們需要的信息, 這時候我們指定的 tag就派上了用場.


adb logcat -s MyAndroid:I


這時將只顯示tag為MyAndroid,級別為I或級別高於I(Warning,Error)的日誌信息.


示例代碼如下:

Ifnotspecifiedonthe commandline,filterspec issetfromANDROID_LOG_TAG
Ifno filterspec is found,filterdefaults to'*:I'

Ifnotspecified with-v,formatissetfromANDROID_PRINTF_LOG
ordefaults to"brief"

㈡ android 源碼log怎麼查看

基本都是android framework層的源碼了。而且最近發現了一個比較不錯的github插件:OctoTree,它 是一個瀏覽器插件,它可以讓你在Github 看代碼時,左邊欄會出現一個樹狀結構,就像我們在IDE 一樣。當我們看一個項目的結構,或者想看具體的某個文件,這樣就會很方便。
怎麼樣這樣查看源代碼的話是不是很方面?
好了說一下我們今天需要介紹的Log對象,它位於android framework層utils包下,是一個final class類:查看其具體定義:
public final class Log {

/**
* Priority constant for the println method; use Log.v.
*/
public static final int VERBOSE = 2;

/**
* Priority constant for the println method; use Log.d.
*/
public static final int DEBUG = 3;

/**
* Priority constant for the println method; use Log.i.
*/
public static final int INFO = 4;

/**
* Priority constant for the println method; use Log.w.
*/
public static final int WARN = 5;

/**
* Priority constant for the println method; use Log.e.
*/
public static final int ERROR = 6;

/**
* Priority constant for the println method.
*/
public static final int ASSERT = 7;

private Log() {
}

/**
* Send a {@link #VERBOSE} log message.
* @param tag Used to identify the source of a log message. It usually identifies
* the class or activity where the log call occurs.
* @param msg The message you would like logged.
*/
public static int v(String tag, String msg) {
return println(LOG_ID_MAIN, VERBOSE, tag, msg);
}

/**
* Send a {@link #VERBOSE} log message and log the exception.
* @param tag Used to identify the source of a log message. It usually identifies
* the class or activity where the log call occurs.
* @param msg The message you would like logged.
* @param tr An exception to log
*/
public static int v(String tag, String

㈢ android開發怎麼看log

可以用真機測試,要在DDMS里選擇你的機器,然後LOGCAT里才可以出來。。如果還不出來。那你只能用程序來列印到手機上了。傳做一個界面,來列印你的日誌。

㈣ 如何查看android系統log

手機查看需要Root許可權,下一個Terminal,執行「su -c logcat」即可對應於/dev/log/main文件 查看原帖>>

㈤ android開發 手機調試怎麼打開log

啟動Android Studio,選中android工程並打開
Android Studio中如何查看Logcat調試信息
工具欄選擇【Tools】-》【Android】
Android Studio中如何查看Logcat調試信息
點擊【Android】選項,子選項選中【Android Device Monitor】,彈出窗口,該窗口類似eclipse
Android Studio中如何查看Logcat調試信息
Android Device Monitor窗口,如圖
Android Studio中如何查看Logcat調試信息
Android Device Monitor窗口上方有設備管理,可以選中已連接的模擬器或實際設備(android手機、平板),在右側的窗口可以查看當前設備的實時數據及狀態,如:數據連接,線程,文件管理等等
Android Studio中如何查看Logcat調試信息
Android Device Monitor窗口下方為Logcat和Console 控制台
選擇需要追蹤的工程,查看詳細調試信息
Android Studio中如何查看Logcat調試信息
7
可以對調試信息進行過濾,如標簽名,包名,日誌級別等
Android Studio中如何查看Logcat調試信息

㈥ android 如何用cmd方法查看logcat呀

  • 使用cmd命令查看logcat

    • 使用adb logcat命令可查看android系統和應用的log

    • adb logcat //顯示全部日誌
      adb logcat > c: est.log //將日誌輸出保存到文件test.log

  • logcat日誌中的優先順序/tag標記:

    • android輸出的每一條日誌都有一個標記和優先順序與其關聯。

    • 優先順序是下面的字元,順序是從低到高:
      V — 明細 verbose(最低優先順序)
      D — 調試 debug
      I — 信息 info
      W — 警告 warn
      E — 錯誤 error
      F — 嚴重錯誤 fatal
      S — 無記載 silent

    • 標記是一個簡短的字元串,用於標識原始消息的來源。如下是一個日誌輸出的消息,優先順序是「D」,標記是「PowerManagerService」:

      D/PowerManagerService( 305): onSensorChanged: light value: 306.0

  • 可根據tag標記和級別過濾日誌輸出:

    • 僅輸出標記為「ActivityManager」且優先順序大於等於「Info」和標記為「PowerManagerService」並且優先順序大於等於「Debug」的日誌:

      adb logcat ActivityManager:I PowerManagerService:D *:S

      註:*:S用於設置所有標記的日誌優先順序為S,這樣可以確保僅輸出符合條件的日誌。

    • adb logcat *:W //顯示所有優先順序大於等於「warning」的日誌

    • adb logcat -s PowerManagerService //顯示PowerManagerService的日誌信息

  • Logcat命令列表:

    • -d 將日誌顯示在控制台後退出
      -c 清理已存在的日誌
      -f <filename> 將日誌輸出到文件
      adb logcat -f /sdcard/test.txt

    • -v <format>設置日誌輸入格式控制輸出欄位,默認的是brief格式

    • brief — 顯示優先順序/標記和原始進程的PID (默認格式)
      process — 僅顯示進程PID
      tag — 僅顯示優先順序/標記
      thread — 僅顯示進程:線程和優先順序/標記
      raw — 顯示原始的日誌信息,沒有其他的元數據欄位
      time — 顯示日期,調用時間,優先順序/標記,PID
      long —顯示所有的元數據欄位並且用空行分隔消息內容

    • adb logcat -v thread //使用 thread 輸出格式
      注意-v 選項中只能指定一種格式。

    • -b <buffer>載入一個可使用的日誌緩沖區供查看,默認值是main。
      radio — 查看包含在無線/電話相關的緩沖區消息
      events — 查看事件相關的消息
      main — 查看主緩沖區 (默認緩沖區)

      adb logcat -b radio //查看radio緩沖區


㈦ 如何獲取 android 的系統日誌 logcat

在windows7操作系統下,開發平台為android studio可以按照如下步驟獲取android 的系統日誌 logcat。

1、首先打開android studio的頁面,如下圖:

㈧ android怎麼把log日誌直觀的顯示出來

切換到QQ下面的「動態」選項卡,進入「興趣部落」(我只在興趣部落弄了,其他地方沒有試過)。
然後用手指連續點擊「興趣部落」幾個大標題幾次,就會彈出一個對話框,提示你
是否開啟log
選擇yes之後,就會彈出一個log日誌詳情對話框。
點擊右上角的關閉按鈕,日誌對話框就會隱藏起來,至顯示一個「+」小圖標,在此點擊這個小圖標,窗口就會恢復回來
5
關閉log窗口,只需在頁面上在此連續點擊幾次就可以關閉窗口了,有興趣的同學可以試試
:)

㈨ 如何在android手機上查看log

使用cmd命令查看logcat 使用adb logcat命令可查看android系統和應用的log adb logca

㈩ 手機android系統 怎麼看log

使用cmd命令查看logcat 使用adb logcat命令可查看android系統和應用的log adb logcat //顯示全部日誌adb logcat > c:\test.log //將日誌輸出保存到文件test.log logcat日誌中的優先順序/tag標記: android輸出的每一條日誌都有一個標記和優先順序與...

熱點內容
機械硬碟的存儲速度優於固態硬碟 發布:2024-04-26 16:02:13 瀏覽:117
訊捷壓縮器 發布:2024-04-26 16:02:08 瀏覽:268
安卓藍牙耳機丟了如何找回 發布:2024-04-26 15:36:13 瀏覽:540
win7最近打開文件夾 發布:2024-04-26 15:23:00 瀏覽:555
演算法筆談 發布:2024-04-26 15:14:34 瀏覽:284
技算計編程 發布:2024-04-26 14:43:42 瀏覽:140
開普票密碼區和備注是什麼意思 發布:2024-04-26 14:43:31 瀏覽:852
吃雞安卓和蘋果如何加好友 發布:2024-04-26 14:39:10 瀏覽:836
centos編譯命令 發布:2024-04-26 14:18:04 瀏覽:654
網路編程畢設 發布:2024-04-26 14:13:10 瀏覽:208