【问题标题】:After device restart ,How to Get Dumpstate/ABD logs of old session设备重启后,如何获取旧会话的 Dumpstate/ABD 日志
【发布时间】:2014-12-31 11:15:42
【问题描述】:

伙计们,

我不知何故来到这里,想知道是否有任何隐藏命令来获取日志?“设备重启后,如何获取旧会话的 Dumpstate/ABD 日志。”

android系统随机重启时是否会写入一些调试问题的日志?

谢谢 尼茨

【问题讨论】:

    标签: java android logging adb


    【解决方案1】:

    根据您的应用程序状态,您可以像这样将日志保存在文本文件中 -

    public void appendLog(String text)
    {       
       File logFile = new File("sdcard/log.file");
       if (!logFile.exists())
       {
          try
          {
             logFile.createNewFile();
          } 
          catch (IOException e)
          {
             // TODO Auto-generated catch block
             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)
       {
          // TODO Auto-generated catch block
          e.printStackTrace();
       }
    }
    

    希望这会有所帮助:)

    【讨论】:

      猜你喜欢
      • 2012-09-11
      • 2014-02-10
      • 1970-01-01
      • 1970-01-01
      • 2013-09-16
      • 1970-01-01
      • 2011-03-28
      • 2014-11-30
      • 1970-01-01
      相关资源
      最近更新 更多