0

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)

asked Jun 29, 2025 at 16:43
2
  • Please include a sample output that would trigger both logcat queries. Commented Jun 30, 2025 at 12:20
  • @Robert please see the newly attached image Commented Jul 1, 2025 at 12:31

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.