版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
Android開發(fā)使用adblogcat顯示Android日記Android開發(fā)使用adblogcat顯示Android日記1.分析adblogcat的幫助信息在命令行中輸入adblogcat--help命令,就可以顯示該命令的幫助信息;[plain]viewplaincopyoctopus@octopus:~$adblogcat--helpUsage:logcat[options][filterspecs]optionsinclude:-sSetdefaultfiltertosilent.Likespecifyingfilterspec'*:s'-f<filename>Logtofile.Defaulttostdout-r[<kbytes>]Rotatelogeverykbytes.(16ifunspecified).Requires-f-n<count>Setsmaxnumberofrotatedlogsto<count>,default4-v<format>Setsthelogprintformat,where<format>isoneof:briefprocesstagthreadrawtimethreadtimelong-cclear(flush)theentirelogandexit-ddumpthelogandthenexit(don'tblock)-t<count>printonlythemostrecent<count>lines(implies-d)-ggetthesizeofthelog'sringbufferandexit-b<buffer>Requestalternateringbuffer,'main','system','radio'or'events'.Multiple-bparametersareallowedandtheresultsareinterleaved.Thedefaultis-bmain-bsystem.-Boutputtheloginbinaryfilterspecsareaseriesof<tag>[:priority]where<tag>isalogcomponenttag(or*forall)andpriorityis:VerboseDDebugIInfoWWarnErrorFatalSSilent(supressalloutput)'*'means'*:d'and<tag>byitselfmeans<tag>:vIfnotspecifiedonthecommandline,filterspecissetfromANDROID_LOG_TAGS.Ifnofilterspecisfound,filterdefaultsto'*:I'Ifnotspecifiedwith-v,formatissetfromANDROID_PRINTF_LOGordefaultsto"brief"adblogcat和過濾項
命令格式:adblogcat[選項][過濾項],在中括號[]中,說明這是可選的;(1)
此中選項選項分析選項分析
:--"-s"選項:設置輸出日記的標簽,只顯示該標簽的日記;--"-f"選項:將日記輸出到文件,默認輸出到標準輸出流中,-f參數(shù)執(zhí)行不行功;"-r"選項:依據(jù)每千字節(jié)輸出日記,需要-f參數(shù),但是這個命令沒有執(zhí)行成功;"-n"選項:設置日記輸出的最大數(shù)量,需要-r參數(shù),這個執(zhí)行感覺跟adblogcat成效相同;"-v"選項:設置日記的輸出格式,注意只好設置一項;"-c"選項:清空全部的日記緩存信息;"-d"選項:將緩存的日記輸出到屏幕上,而且不會堵塞;"-t"選項:輸出近來的幾行日記,輸出完退出,不堵塞;"-g"選項:查察日記緩沖區(qū)信息;"-b"選項:加載一個日記緩沖區(qū),默認是main,下邊詳解;"-B"選項:以二進制形式輸出日記;.輸出指定標簽內容:"-s"選項:設置默認的過濾器,如我們想要輸出"System.out"標簽的信息,就可以使用adblogcat-sSystem.out命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-sSystem.out---------beginningof/dev/log/system---------beginningof/dev/log/mainI/System.out(22930):GSM-91I/System.out(22930):SignalStrengthissssssssss:-91I/System.out(22930):GSM-91I/System.out(22930):SignalStrengthissssssssss:-91I/System.out(22930):SupervisorThreadI/System.out(22930):Gotrunmode輸出日記信息到文件
:--"-f"選項:該選向后邊跟著輸入日記的文件,使用adblogcat-flog命令,會出現(xiàn)錯誤,這里我們不介紹使用該選項;[plain]viewplaincopyoctopus@octopus:~$adblogcat-flogcouldn'topenoutputfile:Read-onlyfilesystem
--">"
輸出:">"后邊跟著要輸出的日記文件,可以將logcat日志輸出到文件中,使用adblogcat>log命令,使用morelog命令查察日記信息;[plain]viewplaincopyoctopus@octopus:~$adblogcat>log^Coctopus@octopus:~$morelog---------beginningof/dev/log/systemV/ActivityManager(500):Wehavependingthumbnails:nullV/ActivityManager(500):getTasks:max=1,flags=0,receiver=nullV/ActivityManager(500):com.android.settings/.Settings:task=TaskRecord{42392278#448Acom.android.settingsU0}V/ActivityManager(500):Wehavependingthumbnails:null指定logcat的日記輸出格式:"-v"選項:使用adblogcat-vtime命令,可以啥看日記的輸出時間;--"brief"格式:這是默認的日記格式"優(yōu)先級/標簽(進程ID):日記信息",使用adblogcat-vprief命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-vbrief---------beginningof/dev/log/systemD/PowerManagerService(500):handleSandman:canDream=true,mWakefulness=AwakeD/PowerManagerService(500):releaseWakeLockInternal:lock=1101267696,flags=0x0--"process"格式:"優(yōu)先級(進度ID):日記信息",使用adblogcat-vprocess命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-vprocess---------beginningof/dev/log/systemD(500)MobileDataStateReceiverreceived:ACTION_ANY_DATA_CONNECTION_STATE_CHANGED_MOBILE[wap](MobileDataStateTracker)V(500)Broadcast:Intent{act=ent.action.ANY_DATA_STATE_MOBILEflg=0x10(hasextras)}ordered=trueuserid=0(ActivityManager)D(500)wap:IntentfromSIM0,currentSIM0,currentDataStateDISCONNECTED(MobileDataStateTracker)D(500)wap:wapsettingisAvailabletofalse(MobileDataStateTracker)D(500)wap:Receivedstate=DISCONNECTED,old=DISCONNECTED,reason=dataDetached(MobileDataStateTracker)D(500)BDC-CallingfinishReceiver:IIntentReceiver=41c46ba0(ActivityThread)--"tag"格式:"優(yōu)先級/標簽:日記信息",使用adblogcat-vtag命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-vtag---------beginningof/dev/log/systemI/PowerManagerService:setBrightnessmButtonLight0.D/PowerManagerService:updateScreenStateLocked:mDisplayReady=true,newScreenState=2,mWakefulness=1,mWakeLockSummary=0x1,mUserActivitySummary=0x1,mBootCompleted=trueD/PowerManagerService:handleSandman:canDream=true,mWakefulness=Awake--"thread"格式:"優(yōu)先級(進度ID:線程ID)標簽:日記內容",使用adblogcat-vtag
命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-vthread---------beginningof/dev/log/systemV(500:2141)getTasks:max=1,flags=0,receiver=nullV(500:2141)com.lewa.launcher/.Launcher:task=TaskRecord{41dccc20#425Acom.lewa.launcherU0}V(500:2141)Wehavependingthumbnails:nullV(500:2140)getTasks:max=1,flags=0,receiver=null--"raw"格式:只輸出日記信息,不附帶任何其余信息,如優(yōu)先級標簽等,使用adblogcat-vraw命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-vraw---------beginningof/dev/log/systemnotificationsareenabledforcom.kindroid.securityAssignedscore=0toNotification(pri=0contentView=com.kindroid.security/0x7f030052vibrate=nullsound=nulldefaults=0x0flags=0x2kind=[null])Nativesetalarm:Alarm{41e1ca00type3com.kindroid.security}resetpoweroffalarmnone--"time"格式:"日期時間優(yōu)先級/標簽(進度ID):進度名稱:日記信息",使用adblogcat-vtime命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-vtime---------beginningof/dev/log/system04-2517:18:13.019V/ActivityManager(500):Broadcaststicky:Intent{act=ent.action.SIG_STRflg=0x10(hasextras)}ordered=falseuserid=-104-2517:18:13.157V/NotificationService(500):enqueueNotificationInternal:pkg=com.kindroid.securityid=1020notification=Notification(pri=0contentView=com.kindroid.security/0x7f030052vibrate=nullsound=nulldefaults=0x0flags=0x2kind=[null])04-2517:18:13.158V/NotificationService(500):notifications04-2517:18:13.158V/NotificationService(500):Assignedscore=0toNotification(pri=0sound=nulldefaults=0x0flags=0x2kind=[null])04-2517:18:13.555V/ActivityManager(500):getTasks:max=1,flags=0,receiver=null--"long"格式:"[日期時間進度ID:線程ID優(yōu)先級/標簽]日記信息",輸出以上提到的全部的頭信息,使用adblogcat-vlong命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-vlong---------beginningof/dev/log/system[04-2517:21:18.118500:0x2feV/ActivityManager]Wehavependingthumbnails:null[04-2517:21:18.696593:0x251W/ActivityThread]Contentproviderpublishedastelephony[04-2517:21:19.119500:0x396V/ActivityManager]getTasks:max=1,flags=0,receiver=null清空日記緩存信息:使用adblogcat-c命令,可以將以前的日記信息清空,重新開始輸出日記信息;將緩存日記輸出:使用adblogcat-d命令,輸出命令,以后推出命令,不會進行堵塞;輸出近來的日記:使用adblogcat-t5命令,可以輸出近來的5行日記,而且不會堵塞;[plain]viewplaincopyoctopus@octopus:~$adblogcat-t5---------beginningof/dev/log/system---------beginningof/dev/log/mainW/ADB_SERVICES(10028):adb:unabletoopen/proc/10028/oom_adjD/dalvikvm(23292):threadid=11:createdfrominterpD/dalvikvm(23292):startnewthreadD/dalvikvm(23292):threadid=11:notifydebuggerD/dalvikvm(23292):threadid=11(Thread-24538):callingrun( )octopus@octopus:~$查察日記緩沖區(qū)信息:使用adblogcat-g命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-g/dev/log/main:ringbufferis256Kb(255Kbconsumed),maxentryis5120b,maxpayloadis4076b/dev/log/system:ringbufferis256Kb(255Kbconsumed),maxentryis5120b,maxpayloadis4076boctopus@octopus:~$加載日記緩沖區(qū)
:使用
adblogcat-b
緩沖區(qū)種類
命令;Android中的日記緩沖區(qū):system緩沖區(qū)-與系統(tǒng)相關的日記信息,radio緩沖區(qū)-廣播電話相關的日記信息,events緩沖區(qū)-事件相關的日記信息,main緩沖區(qū)-默認的緩沖區(qū);[plain]viewplaincopyoctopus@octopus:~$adblogcat-bradio-t5D/PHONE(23599):[GeminiDataSubUtil]UAPP_C6-4D/GSM(23599):[GDCT][simId1]apnType=defaultD/GSM(23599):[GDCT][simId1]isDataAllowed:notalloweddueto-gprs=1-SIMnotloaded-desiredPowerState=falseD/GSM(23599):[GDCT][simId1]isDataPossible(default):possible=falseisDataAllowed=falseapnTypePossible=trueapnContextisEnabled=trueapnContextState( )=IDLEI/MUXD(23591):[gsm0710muxd]3426:main( ):Framesreceived/dropped:18242/0octopus@octopus:~$octopus@octopus:~$adblogcat-bmain-t5D/NotificationService(500):notification.sound=nullD/NotificationService(500):mDmLock=falseI/ATCIJ(16576):Couldn'tfind'atci-serv-fw'socket;retryingaftertimeoutW/ADB_SERVICES(246):create_local_service_socket( )name=shell:exportANDROID_LOG_TAGS="";execlogcat-bmain-t5W/ADB_SERVICES(16815):adb:unabletoopen/proc/16815/oom_adjoctopus@octopus:~$octopus@octopus:~$adblogcat-bsystem-t5D/PowerManagerService(500):updateScreenStateLocked:mDisplayReady=true,newScreenState=0,mWakefulness=0,mWakeLockSummary=0x1,mUserActivitySummary=0x0,mBootCompleted=trueD/PowerManagerService(500):handleSandman:canDream=false,mWakefulness=AsleepV/NotificationService(500):enqueueNotificationInternal:pkg=com.kindroid.securityid=1020notification=Notification(pri=0sound=nulldefaults=0x0flags=0x2kind=[null])V/NotificationService(500):notificationsareenabledforV/NotificationService(500):Assignedscore=0toNotification(pri=0sound=nulldefaults=0x0flags=0x2kind=[null])octopus@octopus:~$octopus@octopus:~$adblogcat-bevent-t5Unabletoopenlogdevice'/dev/log/event':Nosuchfileordirectoryoctopus@octopus:~$adblogcat-bevents-t5I/notification_cancel(500):[com.kindroid.security,1026,NULL,0,0,64]I/notification_enqueue(500):[com.kindroid.security,1020,NULL,0,Notification(pri=0sound=nulldefaults=0x0flags=0x2kind=[null])]I/notification_cancel(500):[com.kindroid.security,1026,NULL,0,0,64]I/notification_enqueue(500):[com.kindroid.security,1020,NULL,0,Notification(pri=0sound=nulldefaults=0x0flags=0x2kind=[null])]I/notification_cancel(500):[com.kindroid.security,1026,NULL,0,0,64]octopus@octopus:~$以二進制形式輸出日記:使用adblogcat-B命令;[plain]viewplaincopyoctopus@octopus:~$adblogcat-B-t5O??_?3ZS?4gps_mt3326nmea_reader_parse:line=1218GPSgetaccuracyfailed,fixmode:1^??_?3ZS?=gps_mt3326nmea_reader_addc:line=1331thestructureincludenmea_cbaddressis0x658cc8e8H??_?3ZSEGEgps_mt3326nmea_reader_addc:line=1332nmea_cbaddressis0x5d2fe279i???3ZS?)>ADB_SERVICEScreate_local_service_socket( )name=shell:exportANDROID_LOG_TAGS="";execlogcat-B-t57*E*E?3ZSo?YADB_SERVICESadb:unabletoopen/proc/17706/oom_adj(2)過濾項分析過濾項格式:<tag>[:priority],標簽:日記等級,默認的日記過濾項是"*:I";V:Verbose(明細);D:Debug(調試);I:Info(信息);W:Warn(警告);E:Error(錯誤);F:Fatal(嚴重錯誤);S:Silent(Superalloutput)(最高的優(yōu)先級,可能不會記錄東西);過濾指定等級日記:使用adblogcat10*:E命令,顯示Error以上司其余日記;[plain]viewplaincopyoctopus@octopus:~$adblogcat*:ENote:logswitchoff,onlylog_mainandlog_eventswillhavelogs!---------beginningof/dev/log/mainE/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;E/WifiHW(441):wifi_send_command:AP_SCAN1;interfaceindex=0;E/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;E/dalvikvm(756):GC_CONCURRENTfreed1809K,27%free19489K/26695K,paused16ms+5ms,total109msE/WifiHW(441):wifi_send_command:SCAN;interfaceindex=0;E/WifiHW(441):wifi_send_command:AP_SCAN1;interfaceindex=0;E/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;E/dalvikvm(756):GC_CONCURRENTfreed1820K,27%free19490K/26695K,paused16ms+3ms,total102msE/WifiHW(441):wifi_send_command:AP_SCAN1;interfaceindex=0;E/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;過濾指定標簽等級日記
:使用
adblogcatWifiHW:D*:S
命令進行過濾
;--命令含義
:輸出
10條日記
,
日記是標簽為
WifiHW,
并且優(yōu)先級Debug(調試)等級以上的級其余日記;注意*:S:假如沒有*S就會輸犯錯誤;[plain]viewplaincopyoctopus@octopus:~$adblogcatWifiHW:D*:SNote:logswitchoff,onlylog_mainandlog_eventswillhavelogs!---------beginningof/dev/log/mainE/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;E/WifiHW(441):wifi_send_command:AP_SCAN1;interfaceindex=0;E/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;E/WifiHW(441):wifi_send_command:AP_SCAN1;interfaceindex=0;E/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;E/WifiHW(441):wifi_send_command:AP_SCAN1;interfaceindex=0;E/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;可以同時設置多個過濾器:使用adblogcatWifiHW:Ddalvikvm:I*:S命令,輸出WifiHW標簽的Debug以上司別和dalvikvm標簽的Info以上司其余日記;[plain]viewplaincopyoctopus@octopus:~$adblogcatWifiHW:Ddalvikvm:I*:SNote:logswitchoff,onlylog_mainandlog_eventswillhavelogs!---------beginningof/dev/log/mainE/WifiHW(441):wifi_send_command:AP_SCAN1;interfaceindex=0;E/WifiHW(441):wifi_send_command:SCAN_RESULTS;interfaceindex=0;E/dalvikvm(756):GC_CONCURRENTfreed1820K,27%f
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- “循光而行多元造夢”瀘州老窖集團2025校園招聘67人筆試參考題庫附帶答案詳解(3卷)
- 2025福建聯(lián)通是中國聯(lián)合網(wǎng)絡通信有限公司校園招聘(43個崗位)筆試參考題庫附帶答案詳解(3卷)
- 2025湖南湘潭韶山文博文化發(fā)展有限公司招聘6人筆試參考題庫附帶答案詳解(3卷合一版)
- 2025浙江臺州市安誠能源科技有限公司招聘財務人員1人筆試參考題庫附帶答案詳解(3卷)
- 2025中鐵二院工程集團有限責任公司公開招聘23人筆試參考題庫附帶答案詳解(3卷)
- 龍口市2023年山東煙臺龍口市事業(yè)單位公開招聘高層次人才58人第二輪龍口市考筆試歷年參考題庫典型考點附帶答案詳解(3卷合一)
- 2026年大連單招嬰幼兒發(fā)展與健康管理專業(yè)技能模擬卷含答案
- 2026年福建單招職業(yè)技能案例分析簡答題含答案主觀題專項
- 2026年陜西單招護理專業(yè)技能操作規(guī)范經(jīng)典題詳解
- 2026年寧波單招文化素質語文專項訓練含答案古詩文閱讀理解作文
- (一診)達州市2026屆高三第一次診斷性測試歷史試題(含答案)
- 《汽車網(wǎng)絡與新媒體營銷》期末考試復習題庫(附答案)
- 生產(chǎn)廠長年度工作總結
- 工業(yè)傳感器精度提升研發(fā)及電子制造應用項目階段性推進成效及策略
- 管理金字塔游戲
- 中國銀發(fā)經(jīng)濟市場與投資賽道66條(2025)(精要版)
- 衛(wèi)生器材與裝備操作使用試題和答案
- 2025-2026學年湖南省永州市高三上學期一?;瘜W試題及答案
- 2025年國家開放大學《管理心理學》期末考試備考題庫及答案解析
- 抹墻加固高延性混凝土施工方案
- 2025年內蒙古行政執(zhí)法人員執(zhí)法證考試題庫及答案
評論
0/150
提交評論