Android Development: Filter LogCat
LogCat is extremely helpful when it comes to tracking bugs and potential problems in your Android app. However, the list of logged messages in LogCat can get very long and make it impossible to manage or find what you want. By using custom filters to narrow down the LogCat, you can find the log message you want easily.
1. Launch Eclipse, and open the project you are working on.
2. If the LogCat window is not visible, open it by navigating to Window -> Show View -> Other. In the Show View window, expand the Android folder, and choose the LogCat option from there.
3. Now, the active tab at the bottom of Eclipse should be LogCat. While you are in this tab, click the green plus sign on the left-hand side to add a new filter.
4. Give your custom filter a name. The filter name can be whatever you want. It does not affect how LogCat is filtered. However, an appropriate, specific name will help you identify which is which, especially when you have multiple custom filters. It is possible to filter the logcat by the log tag, log message, pid and minimum log level. By default, all filter fields are blank which means that the they will match all messages. Providing filter information in the appropriate field will narrow down the list. In this example, I have decided to filter all the results from the Log.d() method with the custom tag of “custom_activity“. For more information about using the log method, please refer to the Android Developer document. When you are done, click OK to save the filter.
5. Run the application on the emulator or a real device, do whatever your app requires to trigger sending out the log message, and click the newly created filter in the LogCat tab to see the result.
Follow the reactions below and share your own thoughts.