在IntelliJ上,我正在尝试读取logcat以查找错误。
问题是所有应用程序的日志都在“Android”窗口中。
如何仅显示相关的日志?
我不需要标签,因为我想查看来自JNI的异常抛出、Segfaults等。
谢谢!
在IntelliJ上,我正在尝试读取logcat以查找错误。
问题是所有应用程序的日志都在“Android”窗口中。
如何仅显示相关的日志?
我不需要标签,因为我想查看来自JNI的异常抛出、Segfaults等。
谢谢!
在当前版本(12)的IntelliJ IDEA中,无法基于应用程序(包)进行过滤。
/**
* Wrapper for the Android {@link Log} class.
* <br><br>
* The primary reason for doing this is to add a unique prefix to all tags for easier filtering
* in IntelliJ IDEA (since in v12 there is no way to filter by application).
*
* @author gloesch
*/
public class Logger {
private static final String FILTER = "(MY APP) ";
public static void d(String tag, String message) {
Log.d(tag.concat(FILTER), message);
}
public static void i(String tag, String message) {
Log.i(tag.concat(FILTER), message);
}
public static void v(String tag, String message) {
Log.v(tag.concat(FILTER), message);
}
public static void e(String tag, String message) {
Log.e(tag.concat(FILTER), message);
}
public static void w(String tag, String message) {
Log.w(tag.concat(FILTER), message);
}
public static void wtf(String tag, String message) {
Log.wtf(tag.concat(FILTER), message);
}
}
这取决于你想做什么。在logcat窗口中,你应该有一个名为“Filters”的[非]空窗口,旁边有一个+
或-
(在IntelliJ IDEA 12中显示),它会弹出一个像这样的窗口: