How to Run Logcat on Multiple Devices Simultaneously

How to Run Logcat on Multiple Devices Simultaneously

21 May 2024 Stephan Petzl Leave a comment Tech-Help

When developing and debugging Android applications, viewing the system logs can be incredibly helpful. Developers often use the logcat utility to monitor these logs in real-time. But what if you’re working with multiple devices at the same time? The standard adb logcat command will return an error if more than one device or emulator is connected. This article provides a guide on how to run logcat for multiple devices simultaneously.

Specifying a Device with ADB

To target a specific device when multiple devices are connected, you can use the -s option followed by the device’s serial number. Here’s how you can do it:

  1. First, list all connected devices to get their serial numbers:
    adb devices
  2. Then, run logcat for a specific device by using its serial number:
    adb -s SERIAL_NUMBER logcat

Replace SERIAL_NUMBER with the actual serial number of the device you want to target. You can find your device’s serial number in the output of the adb devices command.

Running Logcat on Multiple Devices

To monitor logs from multiple devices simultaneously, you’ll need to open separate terminal windows or tabs and run the logcat command with the -s option for each device.

Here’s an example of how to run logcat on two devices:

adb -s 0123456789ABCDEF logcat
adb -s 192.168.198.101:5555 logcat

You can also filter the logcat output by using grep or similar tools. For instance, to filter all log messages containing “System.out”, you can use:

adb -s 192.168.198.101:5555 logcat | grep "System.out"

Repeato: Streamlining Your Testing Workflow

While manually monitoring logcat is essential, automating your testing process can save time and increase efficiency. That’s where Repeato, a No-code test automation tool for iOS and Android, comes into play.

Repeato allows you to create, run, and maintain automated tests for your apps with ease. Its use of computer vision and AI drastically cuts down the time required to edit and run tests. Moreover, Repeato includes ADB on board, enabling you to execute ADB commands via “script steps”, which is particularly useful when you need to time and send ADB commands in sequence during automated testing.

To learn more about how Repeato can integrate into your development and testing routine, visit our documentation or download the tool from our download page.

For more guides and troubleshooting tips on Android development, check out our blog or reach out to us through our contact page if you have any questions.

Like this article? there’s more where that came from!