【问题标题】:Why does LogCat not show the full message?为什么 LogCat 不显示完整的消息?
【发布时间】:2012-08-02 07:11:33
【问题描述】:

有人知道为什么 Logcat 不显示完整消息吗? 我尝试从我的网站打印 xml 响应,但我只能得到其中的一部分..

【问题讨论】:

    标签: android eclipse logcat android-logcat


    【解决方案1】:

    因为您的 logcat 已达到其最大大小,请参阅 What is the size limit for Logcat and how to change its capacity?
    尝试使用此代码将结果写入 sdcard 中的文本文件,然后使用 DDMS 获取它。

     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();
        }
    }
    

    【讨论】:

      【解决方案2】:

      将光标放在错误上,您将看到完整的 log-cat 信息。

      【讨论】:

        猜你喜欢
        • 2012-02-12
        • 2011-10-25
        • 2017-08-03
        • 1970-01-01
        • 1970-01-01
        • 2013-07-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多