有时候第三方应用程序的日志输出是通过printf之类的标准函数输出的,logcat不能捕获到这些日志。一个技巧是使用logwrapper命令来执行第三方应用程序,logwrapper可以把标准输出重定向到adb log中去。(缺省级别是LOGI)
Usage: logwrapper [-x] BINARY [ARGS ...]
Forks and executes BINARY ARGS, redirecting stdout and stderr to
the Android logging system. Tag is set to BINARY, priority is
always LOG_INFO.
-x: Causes logwrapper to SIGSEGV when BINARY terminates
fault address is set to the status of wait()
Source for logwrapper is at: system/core/logwrapper/logwrapper.c
例如,在adb shell下
root@android:/ ps
ps的结果只在当前控制台下输出,要想把ps的结果输出到adb log中去,可以使用:
root@android:/ logwrapper ps
这样adb logcat就能捕获到ps的输出了
在Android中,当第三方应用使用printf等标准输出函数时,logcat无法捕获这些日志。通过logwrapper工具,可以将标准输出重定向到adb logcat,便于日志收集。例如,使用`logwrapper ps`命令,即可将`ps`命令的输出记录到adb日志。
2785

被折叠的 条评论
为什么被折叠?



