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.
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.
Use ps/grep/cut to grab the PID, then grep for logcat entries with that PID. Here's the command I use:
adb logcat | grep -F "`adb shell ps | grep com.asanayoga.asanarebel | tr -s [:space:] ' ' | cut -d' ' -f2`"
(You could improve the regex further to avoid the theoretical problem of unrelated log lines containing the same number, but it's never been an issue for me)
This also works when matching multiple processes.
On Windows you can do:
adb logcat | findstr com.example.package
Ubuntu : adb logcat -b all -v color --pid=`adb shell pidof -s com.packagename` With color and continous log of app
If you are using Android Studio you can select the process from which you want to receive logcats. Here is the screenshot.

As a variant you can use third party script PID Cat by Jake Wharton. This script has two major advantages:
From documentation:
During application development you often want to only display log messages coming from your app. Unfortunately, because the process ID changes every time you deploy to the phone it becomes a challenge to grep for the right thing.
This script solves that problem by filtering by application package.
In order to access the logcats you first need to install ADB command-line tool. ADB command-line tool is a part of android studio platform tools and can be downloaded from here. After this, you need to set the path/environment variable for adb tools. Now you can access logcat from eclipse terminal/ intellij terminal or mac terminal in case you are using a macbook.
adb logcat : To get entire logcat.
adb shell pidof 'com.example.debug' : To get the process id of your app.
adb logcat pid=<pid> : To get logcat specific to your app.
adb logcat pid=<pid>|grep 'sometext' : To filter logcat on basis of some text.
For more info about filtering logcats read this.
I am usually adding something in the log messages to make it distinct. Or for example unity app you can use "Unity" as matching string.
For mac :
adb logcat | grep "MyUniqueString"
for Windows (powershell ):
adb logcat | Select-String "MyUniqueString"
I have different approach, you can try access to local device's shell.
adb shell
and then follow by
logcat | grep com.package.name
This print all containing that package.
Alternatively, You can try flutter logs --verbose
Another way of getting logs of exact package name when you are inside the shell:
logcat --pid $(ps -ef | grep -E "com.example.app\$" | awk '{print $2}')
For windows, you can use my PowerShell script to show messages for your app only: https://github.com/AlShevelev/power_shell_logcat
You can use below command to fetch verbose logs for your application package
adb logcat com.example.myapp:V *:S
Also if you have rolled out your app and you want to fetch error logs from released app, you can use below command.
adb logcat AndroidRuntime:E *:S
In linux, this worked for me:
adb logcat | grep `adb shell ps | grep your.package | awk '{print $2}'`