logcat

ADB logcat 过滤方法(抓取日志)

喜你入骨 提交于 2020-01-21 20:38:23
1. Log信息级别 Log.v - VERBOSE : 黑色 Log.d - DEBUG : 蓝色 Log.i- INFO : 绿色 Log.w- WARN : 橙色 Log.e- ERROR : 红色 从上而下级别逐次增加 2. 过滤:指定标签,指定级别 adb logcat [TAG:LEVEL ] [TAG:LEVEL ] ... 标签TAG: 在进行log输出时需要指定标签 Log.v("Test", info ); LEVEL: 可以选择:[V D I W E S]中其中一个 TAG:X 的作用为: 输出标签为TAG的log级别大于X的信息 . 例如: adb logcat Test:I 输出 Test的I 和I 级别以上的log,包括 i, w, e 注意: (1)可以指定多个[TAG:LEVEL ] (2) level : S 表示为不输出该标签的日志,应为没有大于S级别的日志了 (3) [TAG:LEVEL ] 不会影响其他标签的日志, 所以如果要屏蔽其他log请使用 *:S adb logcat Test:I *:S 3. 采用grep正则表达式过滤 grep 正则表达式参见grep与正则表达式 adb logcat | grep -E '^[VDE]/(TAG1|TAG2)' 4. 在同时输出到屏幕和文件 tee 想要把日志保存到文件,如果采用IO重定向

Android中日志工具的使用

谁都会走 提交于 2020-01-21 20:27:33
添加LogCat到你的Eclipse 日志在任何项目的开发过程中都会起到非常重要的作用,在Android项目中如果你想要查看日志则必须要使用LogCat工具。当你第一次在Eclipse中运行Android项目的时候,Eclipse会提醒你一次是否要添加LogCat这个工具。如果你现在还没有添加上的话,我这里教你一下如何手动添加LogCat到你的Eclipse中。 点击Eclipse导航栏中的Window→Show View→Other,会弹出一个Show View对话框。你在Show View对话框中展开Android目录,会看到有一个LogCat的子项,然后选中LogCat,点击OK,这样你就成功将LogCat添加到Eclipse中了。 使用Android的日志工具Log LogCat已经添加完成,我们来学习一下如何使用Android的日志工具吧。 Android中的日志工具类是Log(android.util.Log),这个类中提供了如下几个方法来供我们打印日志。 1. Log.v() 这个方法用于打印那些最为琐碎的,意义最小的日志信息。对应级别verbose,是Android日志里面级别最低的一种。 2. Log.d() 这个方法用于打印一些调试信息,这些信息对你调试程序和分析问题应该是有帮助的。对应级别debug,比verbose高一级。 3. Log.i()

java的logcat的简单使用

牧云@^-^@ 提交于 2020-01-21 16:12:31
android.util.Log常用的方法有以下 5 个: Log.v() Log.d() Log.i() Log.w() 以及 Log.e() 。根据首字母对应 VERBOSE , DEBUG,INFO, WARN,ERROR。 1、Log.v 的调试颜色为 黑色 的,任何消息都会输出,这里的v代表verbose啰嗦的意思,平时使用就是Log.v("",""); 2、Log.d的输出颜色是 蓝色 的,仅输出debug调试的意思,但他会输出上层的信息,过滤起来可以通过DDMS的Logcat标签来选择. 3、Log.i的输出为 绿色 ,一般提示性的消息information,它不会输出Log.v和Log.d的信息,但会显示i、w和e的信息 4、Log.w的意思为 橙色 ,可以看作为warning警告,一般需要我们注意优化Android代码,同时选择它后还会输出Log.e的信息。 5、Log.e为红色,可以想到error错误,这里仅显示红色的错误信息,这些错误就需要我们认真的分析,查看栈的信息了。 注意:不同的打印方法在使用时都是某个方法带上(String tag, String msg)参数,tag表示的是打印信息的标签,msg表示的是需要打印的信息。 package com.example.demo; import android.os.Bundle; import android

How to view debug messages on Android?

有些话、适合烂在心里 提交于 2020-01-16 02:55:29
问题 I've got an Android app that works highly unstable and I want to fix it. So I decompiled the apk with apktool and figured that the app call a bunch of Log.d where it writes the useful information. Then I installed a log viewer for Android and figured that it doesn't show anything. I read into the reviews of CatLog (for example) and the user told that it doesn't work on the newest Android version. Well, now I wonder what to do - now can I view the log trace on Android provided my phone isn't

where are logcat filters applied?

不羁岁月 提交于 2020-01-15 07:10:05
问题 I have a single android device attached to the pc and have opened multiple shells which show logcat information. Everyone running with its specific filter. So my question is now, where are those filters applied? Already on the phone so only the filtered messages are sent over usb. Or are they applied on the pc on the adb server or client? I just want to prevent having multiple unfiltered logcat streams running simultaneous over the usb since I have limited bandwitdh. Thanks 回答1: The data is

where are logcat filters applied?

霸气de小男生 提交于 2020-01-15 07:09:07
问题 I have a single android device attached to the pc and have opened multiple shells which show logcat information. Everyone running with its specific filter. So my question is now, where are those filters applied? Already on the phone so only the filtered messages are sent over usb. Or are they applied on the pc on the adb server or client? I just want to prevent having multiple unfiltered logcat streams running simultaneous over the usb since I have limited bandwitdh. Thanks 回答1: The data is

How to disable AdMob logs?

与世无争的帅哥 提交于 2020-01-15 03:52:08
问题 I understood that it's not good practice to publish an app with logs, so i disabled all my log calls. Now AdMob logs every time an ad is displayed, How can i cancel that? i don't seem to find any information about this topic in the documentation, and i've read that you can use ProGuard but that seems like a bad solution. Isn't there someway to disable 3rd party logs? 回答1: Luckily this has already been answered. The best thing to do is simply turn on proguard in your application. Turn on

adb命令依赖包下载及使用常用操作

梦想与她 提交于 2020-01-13 19:34:10
adb命令下载地址:链接: https://pan.baidu.com/s/1f7nqMzgA89Oc7iL73sHzaw 提取码: e3tw 一.logcat抓log方法:adb logcat命令,可以加条件过滤 1.安装SDK(参考android sdk环境安装) 2.使用数据线链接手机,在手机助手的sdcard中建立一个1.log的文件或在抓日志时直接导出到电脑位置 3.程序运行cmd,进入到含有adb.exe目录 4.输入adb devices 查看设备是否连上 5.输入抓取命令: 存放到手机 adb logcat -s *:E > /mmt/sdcard/1.log 存放到PC adb logcat -s '*:E' > d:/1.log 6.使用手机打开app操作崩溃一次(如果想中途停止按下ctrl+c) 7.查看日志抓取文件,分不清楚是那个时间段所造成的后果 8.加入命令:-v time 就会显示出时间 9.输入命令 adb logcat -v time -s *:E > /mmt/sdcard/1.log(eg:adb logcat -v time -s appname:E>d:/1.log) 过滤日志级别 优先级是下面的字符,顺序是从低到高: V — 明细 verbose(最低优先级) D — 调试 debug I — 信息 info W — 警告 warn E

appium启动app

天涯浪子 提交于 2020-01-13 04:38:51
前面一篇已经搭建好了环境,接下来我们就启动app,如何启动呢,首先我们要获取到包名,还要获取到launcherActivity 一、获取apk包名、launcherActivity名 1、清除logcat内容,使用命令adb logcat -c 2、启动logcat,使用命令adb logcat ActivityManager:I *: s 3、打开被测试的app 包名:com.sina.weibo launcherActivity名:com.sina.weibo.VisitorMainTabActivity 二、编写脚本 1platformName:这里是android的apk 2.deviceName:手机设备名称,通过adb devices查看 3.platformVersion:android系统的版本号 4.appPackage:apk包名 5.appActivity:apk的launcherActivity # coding=utf-8 from appium import webdriver desired_caps = { 'platformName' : 'Android' , 'deviceName' : '127.0.0.1:62001' , 'platformVersion' : '5.1.1' , # apk包名 'appPackage' : 'com

Why does android logcat not show the stack trace for a runtime exception?

纵饮孤独 提交于 2020-01-12 12:49:09
问题 An android application that I am currently developing was crashing (fixed that), due to what should have raised an IndexOutOfBoundsException. I was accessing a string in the doInBackground method of a class that extends AyncTask, from the variable arguments parameter (ie String...). I was accidentally accessing index 1 (not 0) of a one element variable argument string (mildly embarrassing...). When the application first crashed I looked at my logcat, (and many times again to confirm that I