I observed that when i use Logcat with Eclipse with ADT for Android, I get messages from many other applications as well. Is there a way to filter this and show only messages from my own application only.
Package names are guaranteed to be unique so you can use the Log
function with your package name in place of the <tag>
and then filter by tag:
NOTE: As of Build Tools 21.0.3 this will no longer work as TAGS are restricted to 23 characters or less.
Log.<log level>("<tag>", "message");
adb -d logcat <tag>:<log level> *:S
-d
denotes an actual device and -e
denotes an emulator. If there's more than 1 emulator running you can use -s emulator-<emulator number>
(eg, -s emulator-5558
)
Example: adb -d logcat com.example.example:I *:S
Or if you are using System.out.print
to send messages to the log you can use adb -d logcat System.out:I *:S
to show only calls to System.out.
You can find all the log levels and more info here: https://developer.android.com/studio/command-line/logcat.html
http://developer.android.com/reference/android/util/Log.html
EDIT: Looks like I jumped the gun a little and just realized you were asking about logcat in Eclipse. What I posted above is for using logcat through adb from the command line. I'm not sure if the same filters transfer over into Eclipse.