为什么LogCat中不显示完整的邮件?中不、完整、邮件、LogCat

2023-09-05 00:44:19 作者:↘傻瓜,你给我滚回来!

任何人都知道为什么LogCat中不显示完整的邮件? 我尝试打印从我的网站的XML响应,但我只可以得到一些吧。

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..

推荐答案

由于您的logcat已达到其最大尺寸,看的什么是大小限制的logcat? 尝试使用这种code来写你的结果到SD卡中,然后使用 DDMS 到一个文本文件明白这一点。

Because your logcat has reached its max size, see What is the size limit for Logcat? 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();
    }
}