最近因为一些原因,想将log日志保存到文件
android studio本身没有这个功能,网上查了以后,总结起来是以下几种方法
1,利用代码,写一个类(麻烦,不想采用)
2,利用第三方工具,android-logging-log4j,使用方法可参考帖子【记录】尝试用android-logging-log4j去实现log输出内容到sd卡中的文件的功能.(也很麻烦,不想采用)
3,最后搜到最后一种方式,打开mac终端,输入<u>adb logcat -d>a.txt</u>, 会显示下图

日志生成的时间比较长

搞定!
网友评论