开发者

how to see the log file in android

开发者 https://www.devze.com 2023-03-05 02:54 出处:网络
I want a code for creating the log file in android and at the run time where to check where this log file is getting created, I also example for the sa开发者_高级运维me in java

I want a code for creating the log file in android and at the run time where to check where this log file is getting created, I also example for the sa开发者_高级运维me in java

Can we create a log file using predefined functions in android itself


You can start your own process of logcat on the device, and redirect the output to some file. This is the basics ( do it on a separate thread)

Process logcat = Runtime.getRuntime().exec("logcat"); // start process
BufferedReader reader = new BufferedReader( new InputStreamReader(logcat.getInputStream())); // grab output stream
// store to file or print to screen


Refer to Log and LogCat.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号