为什么LogCat不显示完整的消息? [英] Why does LogCat not show the full message?

查看:236
本文介绍了为什么LogCat不显示完整的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道为什么Logcat不显示完整的信息?
我尝试从我的网站打印xml响应,但我只能得到一些它。

解决方案

因为你的logcat已达到其最大大小,请参阅 Logcat的大小限制以及如何更改其容量?

尝试使用此代码将结果写入sdcard中的文本文件,然后使用
DDMS 来获取它。

  public static void appendLog字符串文本)
{
文件logFile =新文件(sdcard / log.txt);
if(!logFile.exists())
{
try
{
logFile.createNewFile();
} catch(IOException e)
{
e.printStackTrace();
}
}
尝试
{
// BufferedWriter为性能,true设置追加到文件标志
BufferedWriter buf = new BufferedWriter(new FileWriter( logFile,true));
buf.append(text);
buf.newLine();
buf.close();
} catch(IOException e)
{
e.printStackTrace();
}
}


Anyone knows why Logcat doesn't show full message? I try to print xml response from my site but I only can get some of it..

解决方案

Because your logcat has reached its max size, see What is the size limit for Logcat and how to change its capacity?
Try using this code to write your result into a text file in sdcard, then use DDMS to get it.

 public static void appendLog(String text)
{
    File logFile = new File("sdcard/log.txt");
    if (!logFile.exists())
    {
        try
        {
            logFile.createNewFile();
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }
    try
    {
        // BufferedWriter for performance, true to set append to file flag
        BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
        buf.append(text);
        buf.newLine();
        buf.close();
    } catch (IOException e)
    {
        e.printStackTrace();
    }
}

这篇关于为什么LogCat不显示完整的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆