16

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 !

Intrepidd
  • 19,772
  • 6
  • 55
  • 63

4 Answers4

5

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

Leandros
  • 16,805
  • 9
  • 69
  • 108
4

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);
    }
}
loeschg
  • 29,961
  • 26
  • 97
  • 150
1

You can filter by the process ID (PID):

Filter by PID

The only drawback is that PID changes and you will have to adjust the filter after every app restart.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 1
    how do you get the PID – jAckOdE Apr 05 '13 at 05:57
  • 3
    @jAckOdE // late answer, but help for others, you can see numbers in Android DDMS panel `packagename (12334)`, which number 12334 is PID. anyway it is too uncomfortable to configure PID filter everytime when debugging. – Youngjae May 29 '13 at 02:59
0

Depends on what you're trying to do. In the logcat window, you should have an [non]empty window named "Filters" with a + or - next to it (as it appears in IntelliJ IDEA 12) and it'll pop up a window like this:

Filter window

If the Log Tag isn't what you need, you can filter based on a regexp in the log message itself (e.g. if the message always starts with seek error, then input seek and it should find it. If you set Log Level to Verbose it should match anything that gets written to logcat.

Bry M.
  • 135
  • 2
  • 13