[英]See the log of a jar in android (adb)
i've a question: how can i see the log of a library, which is used as jar into my android app, in the logcat
? 我有一个问题:如何在logcat
查看用作我的android应用程序中的jar的库的日志? Is is also possible to redirect it to a file stored into the sd of the android? 也可以将其重定向到存储在android sd中的文件吗?
To make it clear, the jar libary uses: import java.util.logging.Logger;
为了清楚起见,jar库使用: import java.util.logging.Logger;
where the logger is created as follow private static Logger logger = Logger.getLogger(StreamingEngine.class.getName());
记录器的创建方式如下: private static Logger logger = Logger.getLogger(StreamingEngine.class.getName());
and then the various level as logger.info("..");
然后作为logger.info("..");
的各个级别logger.info("..");
if i check the logcat
i don't see anything from that library. 如果我检查logcat
则看不到该库中的任何内容。 is it my fault (that i don't know how to query logcat) or what? 是我的错(我不知道如何查询logcat)还是什么?
You can write a wrapper which does both logging action 您可以编写一个包装程序,同时执行两个日志记录操作
public class Log
{
private static Logger logger = Logger.getLogger("MAIN_LOGGER");
// info
public static void i(String tag, String message)
{
// logcat
android.util.Log.i(tag, message);
// log4j
logger.info("[" + tag + "] " + message);
}
// TODO other levels
}
It can be improve of course. 当然可以改善。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.