I'm new in Android devices testing and one of colleagues recommended Logcat to check the logs. I'd figured out that by having 2 terminals opened I could complete my task:
- in the first terminal I have the following command:
adb logcat | grep okhttp | cut -b -240 | grep -e "-- "(basically, I want to get all lines with "--" in them, usually the HTTP status codes) - in the second terminal I have the following command:
adb logcat | grep okhttp | cut -b -240.
Basically, with the first terminal, I'm checking I'm hitting the correct endpoints and I get the expected statuses (200), while the second terminal gives me more details in case of 400, 500 errors.
My problem is that the two terminals are not "in sync", meaning, I often have some status codes in one of the terminals and completely different ones in the other terminal (although there is only one Android device connected)
How can I have a consistent output in both terminals (I don't want to miss 400/500 errors because they are not displayed in the first terminal and they are hidden under tons of rows of data in the other one)?
For example, the following picture shows the two terminals, each one of them with one of the commands mentioned above. The top terminal does NOT catch the 500 error, while the bottom one does. The image was not counterfeit, meaning, I hadn't took the photo so fast that the top terminal didn't manage to get the 500 error - I had waited and hope that all the items will be displayed
two terminals showing the output of logcat
I'm using a Mac with Sequoia 15.5, Android Debug Bridge version 1.0.41, Version 35.0.1-11580240, Installed as /opt/homebrew/bin/adb, Running on Darwin 24.5.0 (arm64)
-
Please include a sample output that would trigger both logcat queries.Robert– Robert2025年06月30日 12:20:32 +00:00Commented Jun 30, 2025 at 12:20
-
@Robert please see the newly attached imageradui– radui2025年07月01日 12:31:31 +00:00Commented Jul 1, 2025 at 12:31