• EnglishEspañol日本語한국어Português
  • Log inStart now

Mobile logs

You can use our APIs to send your mobile apps logs to New Relic. Your logs will be in one place where you can analyze them.

APIs to capture logs

APIs are available for iOS and Android.

Important

Note that there may be some mobile logging delays:

  • It will take up to 15 minutes for logs to appear in New Relics Logs tab.
  • It will take up to 15 minutes for changes to mobile logs toggle, sampling rate, and log level to be reflected within your mobile application.

Keep in mind that when you use the logging APIs, you should only use the debug log level if you want to see agent debugging logs.

iOS agent

To use the logging APIs add the following:

NewRelic.logError("Encountered error=error=\(error.localizedDescription).")
NewRelic.logWarning("Warning text.")
NewRelic.logInfo("Info text.")
NewRelic.logVerbose("NewRelic.start was called.")
NewRelic.logDebug("Debug text.")
do {
try errorMethod()
} catch {
NewRelic.logErrorObject(error)
}
NewRelic.logAll([
"logLevel": "WARN",
"message": "This is a test message for the New Relic logging system."
])
NewRelic.logAttributes([
"logLevel": "WARN",
"message": "This is a test message for the New Relic logging system.",
"additionalAttribute1": "attribute1",
"additionalAttribute2": "attribute2"
])

Android agent

To use the logging APIs add the following:

NewRelic.logInfo(String message)
NewRelic.logWarning(String message)
NewRelic.logDebug(String message)
NewRelic.logVerbose(String message)
NewRelic.logError(String message)
NewRelic.log(LogLevel logLevel, String message)
NewRelic.logThrowable(LogLevel logLevel, String message, Throwable throwable)
NewRelic.logAttributes(Map<String, Object> attributes)
NewRelic.logAll(Throwable throwable, Map<String, Object> attributes)

Enable mobile logs

By default, our mobile agent doesn't collect logs. To enable mobile logs:

  1. Go to one.newrelic.com > All capabilities.
  2. Click Mobile.
  3. Click on your mobile app.
  4. In the left pane under Settings, click Application.
  5. Toggle Mobile Logs on.
  6. Click Save.

Configure your logs

To configure your mobile logs sampling rate or log level:

  1. In New Relic, navigate to your mobile app.
  2. In the left pane under Settings, click Application.
  3. To change the sample rate, select a new value in the field under Sample rate of total sessions.
  4. To change the log level, select your preferred log level in the dropdown under Logs verbosity. The debug log level should only be used if you want to see agent debugging logs.

View logs in New Relic

To view your logs, continue in the New Relic UI:

  1. Navigate to your mobile app.
  2. In the left pane under Triage, click Logs.
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.