How to logcat multiple devices at the same time?

How to logcat multiple devices at the same time?

This is actually very easy:

– Just to be sure that you’ll know which terminal (I’m on Mac) window represents which device, unplug all devices first.

– Plug your first device, type “adb devices” and write down your device ID (or just a part of it)

– Plug your next device and type “adb devices” again (you should have now two entries) .. and so on, you got the idea ūüėČ

– Open a new terminal tab

– To monitor one specific plugged device type “adb -s XXXXX logcat -s Unity” where XXXXX is your device ID (copy and paste it from the other terminal tab to here)

– Open another¬†terminal tab, type again “adb -s YYYYY logcat -s Unity” where YYYYY is your second device ID, and so on.

– The first “adb -s” Searches for the device ID, the second “adb -s” will search for a tag inside the logcat so you can search for “FlurryAgent” for example to show your Flurry activity here.

You can also use a different syntax, like this:

adb logcat -s XXXXX AdColonyRewardedVideo:V AdColony:V MoPub:V Unity:V AnotherTag:I *:S

In this case we still search for the device in the first “-s” but¬†I’m adding several tags and also filtering them by¬†their priority level. The “V” means that the tag will be exposed in the Verbose level, which is the lowest one, so you should see everything from that tag. The “*:S” at the end basically means that everything else (“*”) will be ignored (“:S” == Silent)

From the Google Docs about logcat:

The priority is one of the following character values, ordered from lowest to highest priority:

  • V: Verbose (lowest priority)
  • D: Debug
  • I: Info
  • W: Warning
  • E: Error
  • F: Fatal
  • S: Silent (highest priority, on which nothing is ever printed)

 

That’s it.. very useful to debug multiplayer games ūüėČ

Other usefull shortcuts:

–¬†Command + K : will clear your Mac terminal window
– adb logcat -c : will clear your logcat log