Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter only my application log in IntelliJ's logcat? [duplicate]

On IntelliJ, i'm trying to read the logcat for seeking errors.

The problem is that all the applications' log are present in the 'Android' Window.

How to only display the log that is relevant ?

I'm not looking for tags since i want to view Exception throws, Segfaults from JNI, etc.

Thanks !

like image 735
Intrepidd Avatar asked Sep 15 '12 10:09

Intrepidd


2 Answers

Filtering based on an application (package) is not available in IntelliJ IDEA (current version: 12).

like image 93
Leandros Avatar answered Oct 17 '22 09:10

Leandros


EDIT: Everything above the horizontal rule is my new answer (updated 5/17/13):

I'd suggest moving over to the new Android Studio IDE (which is based of IntelliJ). This allows filtering by package name.


You can vote for the feature to be added here: http://youtrack.jetbrains.com/issue/IDEA-95780

In the meantime, you may think about wrapping the Android Log class to add a suffix/prefix that you could then filter by. Something like the following:

/**
 * 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);
    }
}
like image 44
loeschg Avatar answered Oct 17 '22 08:10

loeschg