# How to check Batch logs on Android?

It is possible to view the Batch SDK logs for a given device. This allows you to:

* Easily retrieve your installation ID and your token
* Test that direct opens are detected by Batch
* Check if the SDK or the app is reporting errors

## Prerequisite <a href="#h_e9a5637fd2" id="h_e9a5637fd2"></a>

{% hint style="danger" %}
These steps are only valid for a Mac.
{% endhint %}

To access the logs of a device, you need:

* The 'Developer Options' menu on your device to be enabled (activation mode depending on the device model) ;
* The device to be connected to the computer ;
* The USB debug mode is to be enabled from the phone settings. To do this, go to Developer options > USB Debugging.

<figure><img src="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2FhRWqZ1nILWoDsQTPdCKo%2Ftechnical-guide_android-dev-options_220525.png?alt=media&#x26;token=d7b882d5-6cb5-492b-9dc7-cf9e30d2f748" alt="The image shows two Android smartphone screens demonstrating how to enable USB debugging in Developer Options. 	•	The left screen displays the System settings menu, where the user has selected “Developer options” (highlighted with a red rectangle). 	•	The right screen shows the Developer options menu, where “USB debugging” is toggled on (also highlighted with a red rectangle), indicating that USB debugging is enabled for development purposes."><figcaption></figcaption></figure>

You also need to install adb via Homebrew:

* Install Homebrew:

You can follow the steps described on their [website](https://brew.sh/).

* Install Android tools:

```sh
brew install homebrew/cask/android-platform-tools
```

{% hint style="warning" %}
'brew install' only works for Macs. Instructions for Windows or Linux should be available online.
{% endhint %}

## Commands <a href="#h_ad60451055" id="h_ad60451055"></a>

### Display Batch logs <a href="#h_bd9381587b" id="h_bd9381587b"></a>

Go to the computer terminal.\
Type the following line to watch the logcat:

```sh
adb logcat |grep Batch
```

This will allow ADB to output the logs from the SDK to the computer terminal, allowing you to see your installation ID and your push token when you start the app:

<figure><img src="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2FU3hUpnptSi2WQKYLD5pq%2FtechnicalGuides_adbLogs_260525.png?alt=media&#x26;token=03e15451-6be6-4284-b1b0-5e67f068b55b" alt="An ADB logcat output filtered for &#x22;Batch&#x22; messages, showing an &#x22;Installation ID&#x22; and a &#x22;Push - Registration ID/Push Token (FCM-Token)&#x22;."><figcaption></figcaption></figure>

### Get more detailed logs <a href="#h_b7b56c4a6c" id="h_b7b56c4a6c"></a>

You can also switch to verbose mode:

```sh
adb shell setprop log.tag.BatchInternal VERBOSE
```

You will then need to restart the app.\
This will allow you to see advanced logs, like the display of an In-App message, etc.

{% hint style="warning" %}
These logs are deliberately very verbose, so there can be a lot of them.
{% endhint %}

## Testing your integration <a href="#h_ed1aa27cff" id="h_ed1aa27cff"></a>

You can follow [this guide](https://doc.batch.com/developer/technical-guides/how-to-guides/mobile/android-specific/how-to-test-the-integration-on-android) to test your integration and check what the SDK is logging at the same time.
