[DESCRIPTION]
如何通过adb command去控制MTKLogger 开关,设定log路径等等。
[KEYWORD]
MTKLogger adb控制 路径 大小
[SOLUTION]
1. 开启/关闭
adb shell
am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name
start/stop --ei cmd_target
23
(start表示开启,stop表示关闭;23可改为1/2/4/16,分别代表MobileLog/ModemLog/NetworkLog/GPSLog)
2. 获取开关状态
adb shell getprop debug.MB.running
adb shell getprop debug.mdlogger.Running
adb shell getprop debug.mtklog.netlog.Running
3. 控制Tag Log
Enable Taglog:
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_taglog --ei cmd_target
1
Disable Taglog:
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_taglog --ei cmd_target
0
4. 修改log存储路径
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_logpath -e cmd_target external_sd
——————————————————————————————————————————————————
adb shell setprop persist.mtklog.log2sd.path logpath
JB版本前logpath为:
/mnt/sdcard 内置sd卡
/mnt/sdcard2 外置sd卡
需要做stop/start MTKLogger才能生效
JB版本后logpath为:
internal_sd 内置sd卡
external_sd 外置sd卡
5. 显示MTKLogger主界面
adb shell am start -n com.mediatek.mtklogger/com.mediatek.mtklogger.MainActivity
6. Taglog开启/关闭
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_taglog --ei cmd_target 0/1
(0表示关,1表示开)
7. 切换Mdlog录制模式为USB/SD/Passive Log to SD
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_modem_log_mode --ei cmd_target 1/2/3
(1表示USB模式,2表示SD模式, 3表示Passive Log to SD模式)
M:
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name switch_modem_log_mode_mode --ei cmd_target mdtype
Mode = 1/2/3 -> Usb/sd/pst
Mdtype = 1, 3 -> md1/md3
8. 开机自启动开启/关闭
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name set_auto_start_1/set_auto_start_0 --ei cmd_target 23
(set_auto_start_1表示开启开机自启动,set_auto_start_0表示关闭开机自启动;
23可改为1/2/4/16,分别代表MobileLog/ModemLog/NetworkLog/GPSLog)
9. 设置Limit Current Log Size (JB版本以后生效)
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name set_log_size_300 --ei cmd_target7
(set_log_size_300 可更改为其他合适值如set_log_size_600)
(7可改为1/2/4,分别代表MobileLog/ModemLog/NetworkLog,这里mobilelog 目录大小指的是mtklog/mobilelog下单个APLog的大小;其他modemlog Netlog等都是指的mtklog/下 mdlog netlog等的总大小)
10. 设置Mobile Limit Total Log Size (JB版本以后生效)
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name set_total_log_size_600 --ei cmd_target 1
(只针对mobilelog 有效,最后一位1不可更改;这里设置的是mtklog/mobilelog的总大小)
11.设置MTKLOGGER Show Notification
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name show_notification_1/0 --ei cmd_target -1
(show_notification_1/0 打开或关闭状态栏显示)
12. 清除所有log clear_all_log(N版本)
adb shell am broadcast -a com.mediatek.mtklogger.ADB_CMD -e cmd_name clear_all_logs