2011-06-01 33 views

回答

51

使用-s選項adb

adb -s <serialnumber> 

C:\Users\lel>adb devices 
List of devices attached 
192.168.198.101:5555 device 
ABCDEF  device 

adb -sABCDEF logcat 
adb -s 192.168.198.101:5555 logcat 

您可以結合grep白衣這一點,讓所有包含它的行。
一個實例是具有System.out

實施例:

adb -s 192.168.198.101:5555 logcat | grep "System.out" 
+1

我想我會更加關注亞行參數下一次......對不起,造就了這樣一個明顯的問題。 :) – Kostas 2011-06-01 15:12:56

+1

你是如何得到serialnumber的?我試圖與亞行的設備但給我連接的設備名單 HT05XPL09783 \t設備 100082a42935 \t設備 和亞行logcat -s 100082a42935不起作用 – Lukap 2011-06-29 11:16:00

+3

我發現我的愚蠢的錯誤,應該留像亞行-s 100082a42935 logcat的 – Lukap 2011-06-29 11:17:35

9

我認爲這可能是有用的。我有這個腳本可以幫助我很多。它將每個設備登錄到不同的文件。要停止記錄,只需按CTRL + C。

#! /bin/bash 

devices=`adb devices | grep 'device$' | cut -f1` 
pids="" 

for device in $devices 
do 
    log_file="$device-`date +%d-%m-%H:%M:%S`.log" 
    echo "Logging device $device to \"$log_file\"" 
    adb -s $device logcat -v threadtime > $log_file & 
    pids="$pids $!" 
done 

echo "Children PIDs: $pids" 

killemall() 
{ 
    echo "Killing children (what a shame...)" 

    for pid in $pids 
    do 
     echo "Killing $pid" 
     kill -TERM $pid 
    done 
} 

trap killemall INT 

wait 
0

使用設備IP:
adb -s device_ip:5555

相關問題