Relic Solution: How to collect Build and Runtime logs for iOS and Android apps?

It’s common to face issues with mobile apps. With Build and Run time logs we can gather more details about the errors or crashes. The same can be shared with New Relic support team when you log a ticket which provides deeper insights into the issue you are facing.

Here’s a quick post on how to increase the New Relic Mobile agent logging level and collect the logs.

For iOS apps

Let’s see how we can collect the Build and Run-time logs for iOS apps.

Build Logs - iOS

In Xcode, to view the build log, click on the last icon (text bubble) in the Navigator area located in the top left panel.

Then click on ‘Build’ under the app name to view the build log. You can then save the complete build log in a .txt file just by clicking on Save button (top right corner) from the same page.

Runtime logs - iOS

To increase the logging level

Six log levels are available for mobile apps monitoring:

  • none
  • error
  • warning
  • info
  • verbose
  • ALL

To increase your logging level in the app, add the following method in your app delegate file :

For Objective-C

Just before calling startWithApplicationToken in AppDelegate.m , add:

[NRLogger setLogLevels:NRLogLevelALL];

For Swift

Just before calling start(withApplicationToken:) in AppDelegate.swift , add:


After these settings, please make sure to clean build the code to reflect the new changes.

Run the Console application. You can find it in Applications/Utilities or by opening Spotlight and searching for it.

When it opens, you’ll see a list of devices on the left-hand side. Select the entry that corresponds to the device you’re using in the simulator. An Example screenshot has been added below.

Cmd+A should select all the content and you can paste it in a txt file to share it with us.

For Android apps

We can gather build time logs and run time logs for Android apps as well.

Build Logs - Android

Use below command in the terminal, at the root level of your project folder.

./gradlew --stop && ./gradlew --debug --no-daemon --refresh-dependencies clean assembleRelease > buildLog.txt

If you are running debug or some other variant, change the assembleRelease of the command to your situation.

From Android Studio, you can run this in the inbuilt Terminal as shown below.

The same build log is saved as buildLog.txt in the same path where the above command was run.

Runtime Logs - Android

To increase the agent logging level

There are six log levels.

  • ERROR (least verbose)
  • INFO (default)
  • AUDIT (most verbose)

As AUDIT is the most verbose, set the log level to AUDIT in the default/main activity file where New Relic is initialized.

Code example below.


After setting the log level to AUDIT, build and run to reproduce the error or any crash you are facing.

In Android Studio, you can find the runtime logs in the Logcat window.

You can also collect the runtime log from Terminal by running the command

adb logcat > logcat.txt &

But before running adb command, make sure the path is set to platform-tools in Android SDK library.

export PATH="~/Library/Android/sdk/platform-tools":$PATH

If you are interested to learn more on working with logs, please feel free to check the below document from Android.