Android adb logcat输出日志显示不全解决方案
在终端中使用adb logcat打印服务器json数据,如果返回数据过大超过4000字节(4K)即会截断不显示
原因:logcat在对于message的内存分配大概是4k左右.所以超过的内容都直接被丢弃;
解决方案:切分超过4k的message,使用多个Log.i输出
public static void showLog(String str) {
str = str.trim();
int index = 0;
int maxLength = 4000;
String finalString;
while (index < str.length()) {
if (str.length() <= index + maxLength) {
finalString = str.substring(index);
} else {
finalString = str.substring(index, maxLength);
}
index += maxLength;
LogHelper.i("str", finalString.trim());
}
}
如果想研究源代码,请简单参照如下:
Logcat工具源代码位于system/core/logcat目录下,只有一个源代码文件logcat.cpp,编译后生成的可执行文件位于out/target/product/generic/system/bin目录下,在模拟机中,可以在/system/bin目录下看到logcat工具。
Android adb logcat输出日志显示不全解决方案的更多相关文章
- android adb logcat获取日志文件
一般情况,可以直接在电脑终端上输入logcat来查看手机运行日志,但是测试工作者为了抓取日志文件来给开发人员,需要把日志导出到特定文件中.如下文. 以小米1s手机为例 步骤1:打开第一个终端窗口 ad ...
- 如何过滤 adb logcat 输出
对原作者表示感谢,转自博客:http://www.otechu.me/zh/2011/12/filtering-adb-logcat-output/ 本文介绍如何在 shell 命令行中过滤 adb ...
- Android adb logcat使用技巧
前言 新买的笔记本E431装了最新版的Eclipse,搞定了Android开发环境,可是logcat里查看东西居然仅仅显示level,没有错误的具体信息.我本身也不是一个愿意折腾图形界面,更喜欢纯命令 ...
- 【转】如何过滤 adb logcat 输出
原文网址:http://www.cnblogs.com/imouto/archive/2012/12/11/filtering-adb-logcat-output.html 简介: 本文介绍如何在 s ...
- 如何过滤adb logcat输出
简介: 本文介绍如何在 shell 命令行中过滤 adb logcat 输出的几个小技巧. 开发当中经常看到别人的 log 如洪水般瞬间刷满了屏幕,对自己有用的信息都被淹没了,影响心情也影响效率.下面 ...
- appium+python自动化-adb logcat查看日志
前言 做app测试,遇到异常情况,查看日志是必不可少的,日志如何输出到手机sdcard和电脑的目录呢?这就需要用logcat输出日志了 以下操作是基于windows平台的操作:adb logcat | ...
- 如何过滤 adb logcat 输出(转载)
转自:http://www.cnblogs.com/imouto/archive/2012/12/11/filtering-adb-logcat-output.html 简介: 本文介绍如何在 she ...
- android _scrollview嵌套listview出现高度显示不全解决方案
只要在工具类里写上这一段代码:/** * scrollview嵌套listview显示不全解决 * @param listView */ public static void setListViewH ...
- adb logcat 查看日志
使用 logcat 命令 查看和跟踪系统日志缓冲区的命令logcat的一般用法是: [adb] logcat [<option>] ... [<filter-spec>] .. ...
随机推荐
- [LeetCode&Python] Problem 551. Student Attendance Record I
You are given a string representing an attendance record for a student. The record only contains the ...
- CH0101 a^b、 CH0102 64位整数乘法(快速幂、快速乘)【模板题】
题目链接:传送门 //a^b 传送门 //64位整数乘法 题目: 描述 求 a 的 b 次方对 p 取模的值,其中 ≤a,b,p≤^ 输入格式 三个用空格隔开的整数a,b和p. 输出格 ...
- #include<bits/stdc++.h>的使用
#include<bits/stdc++.h>包含了C++里面所有的库函数,因此在写任何程序的时候只需要加上#include<bits/stdc++.h>即可.
- CentOS安装备忘2
CentOS7安装备忘2 安装过程中不联网,安装完成也不要立刻联网,先关闭远程的服务后再联网更新.安装默认使用English,目的是生成的Home下所有文件夹都是英文的,方便使用. ========= ...
- 《DSP using MATLAB》Problem 7.2
从别的书上找来的
- hdu4965 Fast Matrix Calculation 矩阵快速幂
One day, Alice and Bob felt bored again, Bob knows Alice is a girl who loves math and is just learni ...
- LeetCode - Kth Largest Element in a Stream
Design a class to find the kth largest element in a stream. Note that it is the kth largest element ...
- hibernate中带查询条件的分页
所谓分页,从数据库中分,则是封装一个分页类.利用分页对象进行分页. 但,分页往往带查询条件. 分页类的三个重要数据:[当前页码数],[数据库中的总记录数],[每页显示的数据的条数] 原理:select ...
- ansible-playbook入门实例解析
[root@localhost tlsit]# ansible-playbook a.yml PLAY [test] ***************************************** ...
- 分割(partition,stable_partition)
template <class ForwardIterator, class UnaryPredicate> ForwardIterator partition (ForwardItera ...