How to save LogCat contents to file?

前端 未结 10 1267
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 06:57

I\'ve added debug strings (using Log.d()) and want to see them in context from the contents of logCat. The \"save\" icon for LogCat has a \"Save selected items\" hint, but t

10条回答
  •  死守一世寂寞
    2020-12-05 07:30

    Use logcat tool with -d or -f switch and exec() method.

    Saving to a file on the host computer:

    exec( "adb logcat -d > logcat.log" ) // logcat is written to logcat.log file on the host.
    

    If you are just saving to a file on the device itself, you can use:

    exec( "adb logcat -f logcat.log" ) // logcat is written to logcat.log file on the device.
    

提交回复
热议问题