zoukankan      html  css  js  c++  java
  • logcat--目录

     

     

     代码实现获取log日志和logcat使用方法:http://www.apkbus.com/android-128263-1-1.html

    logcat命令使用方法和查看android系统日志缓冲区内容的方法:--http://www.warting.com/program/201606/166297.html;

     

    http://www.eoeandroid.com/thread-153626-1-1.html?_dsign=633e68ac;

     

    如何获取 android 的系统日志 logcat

     

    android抓取各种log的方法:http://www.kuqin.com/shuoit/20160205/350536.html

     

    Android命令行工具logcat详细用法!:http://www.miui.com/article-272-1.html

     

     

    ------1,在android程序中,如何将LogCat上的日志输出到文件?
    最近在做一个android项目,需要将日志输出到手机上,比如sdCard上,
    根据我的了解LogCat上打印出来的日志到手机上是不能被输出到文件的,
    请问大家谁有没什么方法或者思路,能帮我将日志输出到文件?


    LogCat存储在circular memory buffers中。

    1、可以通过命令来导出Log:

        引用--adb logcat -d > logcat.txt

    2、在程序中获取Log的方法:

    引用
    <uses-permission android:name="android.permission.READ_LOGS" />

    public class LogTest extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    try {
    Process process = Runtime.getRuntime().exec("logcat -d");
    BufferedReader bufferedReader = new BufferedReader(
    new InputStreamReader(process.getInputStream()));

    StringBuilder log=new StringBuilder();
    String line;
    while ((line = bufferedReader.readLine()) != null) {
    log.append(line);
    }
    TextView tv = (TextView)findViewById(R.id.textView1);
    tv.setText(log.toString());
    } catch (IOException e) {
    }
    }
    }

    详细参考
    http://www.helloandroid.com/tutorials/reading-logs-programatically

     

     

  • 相关阅读:
    Redis-其他命令
    Redis-发布与订阅
    C#使用命令编译代码
    Redis有序集合操作
    Redis散列操作
    设置ul水平居中
    Redis集合操作
    Redis列表操作
    java连SQLServer失败 java.lang.ClassNotFoundException:以及 javax.xml.bind.JAXBException
    SQLServer 用法简例
  • 原文地址:https://www.cnblogs.com/awkflf11/p/6075807.html
Copyright © 2011-2022 走看看