重定向输出记录到SD卡上的客户的电话 [英] Redirect Log output to sdcard on customer's phone

查看:109
本文介绍了重定向输出记录到SD卡上的客户的电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户有与我的应用程序有问题,我已经无法重现该问题在我开发的手机。如何调试这个问题?而Android Log类是伟大的,但我的客户不知道如何使用亚行或USB调试电缆。是否有某种方式来记录输出重定向到手机的SD卡上的文件?然后,客户可以很容易地在日志文件发邮件给我。即使这种重定向需要编程就我而言,我至少可以分配一个调试版本的应用程序中。

My customers are having a problem with my app, and I have been unable to reproduce the problem on my development phone. How to debug this problem? The android Log class is great, but my customers do not know how to use 'adb' or the USB debug cable. Is there some way to redirect Log output to a file on the phone's SD card? Then the customer could easily email the log file to me. Even if this redirection requires programming on my part, I could at least distribute a 'debug' version of the app.

谢谢, 汤姆

推荐答案

尝试使用Logger类。该过程等于你会做在一个普通的Java应用程序是什么:

Try using the Logger class. The procedure is equal to what you would do in a regular Java application:

try {
  FileHandler handler = new FileHandler("logfile.log");

  Logger logger = Logger.getLogger("com.somename");
  logger.addHandler(handler);

} catch (IOException e) {

}

实际记录到文件可能是这样做的:

Actual logging to the file could then be done like this:

logger.log(Level.WARNING, "Log message")

祝你好运!

这篇关于重定向输出记录到SD卡上的客户的电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆