logcat

如何过滤 adb logcat 命令的输出

自作多情 提交于 2020-03-17 22:54:48
某厂面试归来,发现自己落伍了!>>> 本文介绍如何在 shell 命令行中过滤 adb logcat 输出的几个小技巧。 开发当中经常看到别人的 log 如洪水般瞬间刷满了屏幕,对自己有用的信息都被淹没了,影响心情也影响效率。下面是几个我所知道的过滤方法。 1. 只显示需要的输出,白名单 最方便的当然是通过管道使用 grep 过滤了,这样可以使用 grep 强大的正则表达式匹配。简单的匹配一行当中的某个字符串,例如 MyApp: adb logcat | grep MyApp adb logcat | grep -i myapp #忽略大小写。 adb logcat | grep --color=auto -i myapp #设置匹配字符串颜色。更多设置请查看 grep 帮助。 进阶一点可以使用 grep 的正则表达式匹配。例如上一个例子会匹配一行中任意位置的 MyApp,可以设置为仅匹配 tag。默认的 log 输出如下,如果修改过输出格式相应的表达式也要修改。 I/CacheService( 665): Preparing DiskCache for all thumbnails. 可以看出 tag 是一行开头的第三个字符开始,根据这点写出表达式: adb logcat | grep "^..MyApp" 根据这个格式也可以设置只显示某个优先级的 log

《自拍教程40》adb命令_一键导出Log

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-11 12:44:17
Android设备,比如车载系统实车路试过程中, 车上操作电脑比较麻烦,如果车载系统出现了Bug, 如何很方便地一次性导出相关的log来(logcat, dbus, 高德地图log,gps定位log等)来呢? 其实我们只需要一个python脚本就可以搞定! 准备阶段 adb pull 命令, 可以把Android系统里的文件,pull到电脑端 导出的Log,需要在当前路径新建一个文件夹用于存放,最好以时间戳命名 os.system()可以调用adb命令 Android车载系统默认的Log存储路径 */ /*--> */ Android Log类型 默认路径 logcat序列log /data/logs/logcat.txt /data/logs/logcat.txt.1 … /data/logs/logcat.txt.20 dbus序列log /data/logs/dbus.txt /data/logs/dbus.txt.1 … /data/logs/dbus.txt.20 kernel序列log /data/logs/kernel.txt /data/logs/kernel.txt.1 ... /data/logs/kernel.txt.20 tombstone log /data/tombstones/* anr卡死log /data/anr/* dropbox log

GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed

﹥>﹥吖頭↗ 提交于 2020-03-05 06:07:46
问题 After migrating to AndroidX,this code has stopped working. Before migrating to AndroidX,this code was working. Error : 2020-02-24 09:41:17.918 17888-17921/edmt.dev.androidgridlayout E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1 BackgroundTask.java: package edmt.dev.androidgridlayout; import android.content.Context; import android.os.AsyncTask; import android.view.View; import android.widget.Toast; import java.io.BufferedReader; import

GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed

你。 提交于 2020-03-05 06:07:22
问题 After migrating to AndroidX,this code has stopped working. Before migrating to AndroidX,this code was working. Error : 2020-02-24 09:41:17.918 17888-17921/edmt.dev.androidgridlayout E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1 BackgroundTask.java: package edmt.dev.androidgridlayout; import android.content.Context; import android.os.AsyncTask; import android.view.View; import android.widget.Toast; import java.io.BufferedReader; import

adb logcat查看手机端日志

一曲冷凌霜 提交于 2020-02-29 11:21:56
前言 做app测试,遇到异常情况,查看日志是必不可少的,日志如何输出到手机sdcard和电脑的目录呢?这就需要用logcat输出日志了 以下操作是基于windows平台的操作:adb logcat | find linux平台的操作可以把find改成grep: adb logcat | grep windows上的dos里面是没grep指令的 logcat输出日志 1.把日志存入手机sdcard某个目录(前提是这个目录要是存在的) adb logcat -f /sdcard/danjie/danjie.txt 备注:-f 将日志输出到文件 上面这个指令在真机上(未root)是会报错的,提示没操作权限,在模拟器上可以执行 2.把日志存入电脑的某个目录,如d:\debug adb logcat >d:debug\danjie.txt 备注这里没-f, 不要问为什么 find过滤包名 1.如果直接用adb logcat抓日志的话,会把系统的一些其他无关紧要的都抓出来,如果只想抓取被测app的日志,那就根据包名过滤 adb logcat | find "com.sankuai.meituan" >d:\hello.txt 结束logcat 1.结束logcat抓包,可以用ctr+c快捷键结束, 这个是通过手工的快捷键操作完成 2.也可以先查询到logcat的pip,再kill掉 adb

Unable to create Debug Bridge: Unable to start adb server: Unable to detect adb version

巧了我就是萌 提交于 2020-02-23 03:56:31
问题 I am currently having this problem when I am opening a project: The errors showing in Event Log : Unable to detect adb version, exit value: 0xc0000409, adb output: adb.exe F 11-11 09:55:06 17768 944 fdevent_poll.cpp:64] failed to create fdevent interrupt socketpair: Invalid argument The errors showing in event Log: Emulator: emulator: ERROR: AdbHostServer.cpp:93: Unable to connect to adb daemon on port: 5037 回答1: This problem is not with your adb.exe or android studio. And you don't need to

android - format json string in adb logcat output

不羁岁月 提交于 2020-02-18 05:45:52
问题 For logging purpose, I print out json response string and can see them in android "adb logcat" command. Is there a way to nicely format the json string in adb logcat output so that it looks like this? { "code" : "0", "text" : "hello world" } 回答1: You can use the JSONObject.toString() method to pretty print the JSON on logcat. Log.d("tag", jsonObject.toString(4)); Output (29124): { (29124): "text": "hello world", (29124): "code": "0" (29124): } 回答2: I don't pretty print the JSON message in

How to filter multiple words in Android Studio logcat

ぃ、小莉子 提交于 2020-02-18 05:45:29
问题 I want to see just a couple of words in logcat. In other words, just a given tags. I tried to enable Regex and type [Encoder|Decoder] as filter, but it doesn't work. 回答1: You should use a grouping construct: (Encoder|Decoder) Actually, you can just use Encoder|Decoder If you use [Encoder|Decoder] , the character class is created that matches any single character E , n , c ... | , D ... or r . See Character Classes or Character Sets: With a "character class", also called "character set", you

How to filter multiple words in Android Studio logcat

孤者浪人 提交于 2020-02-18 05:45:12
问题 I want to see just a couple of words in logcat. In other words, just a given tags. I tried to enable Regex and type [Encoder|Decoder] as filter, but it doesn't work. 回答1: You should use a grouping construct: (Encoder|Decoder) Actually, you can just use Encoder|Decoder If you use [Encoder|Decoder] , the character class is created that matches any single character E , n , c ... | , D ... or r . See Character Classes or Character Sets: With a "character class", also called "character set", you

android - format json string in adb logcat output

微笑、不失礼 提交于 2020-02-18 05:44:28
问题 For logging purpose, I print out json response string and can see them in android "adb logcat" command. Is there a way to nicely format the json string in adb logcat output so that it looks like this? { "code" : "0", "text" : "hello world" } 回答1: You can use the JSONObject.toString() method to pretty print the JSON on logcat. Log.d("tag", jsonObject.toString(4)); Output (29124): { (29124): "text": "hello world", (29124): "code": "0" (29124): } 回答2: I don't pretty print the JSON message in