Skip to content

Commit add1bbe

Browse files
Merge pull request #19356 from mbruin-NR/NR-334798
NR-334798 Created docs that explain the new auto collected logs in the iOS agent (December 3rd)
2 parents 70d7ba7 + 96c53ea commit add1bbe

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Logging with the iOS agent
3+
tags:
4+
- Mobile logging
5+
- New Relic Mobile iOS
6+
metaDescription: Suggestions for setting up the logging in your app with the New Relic agent
7+
freshnessValidatedDate: never
8+
---
9+
10+
11+
To ensure consistent and comprehensive logging throughout the project, the iOS agent provides logging APIs. Use the agent's logging APIs to send your mobile apps logs to New Relic. This ensures that your logs are at one place for your analysis. For more information, refer our [mobile logging API](/docs/mobile-monitoring/mobile-monitoring-ui/mobile-logs/#ios).
12+
13+
14+
## Configuring log levels
15+
16+
You can configure the iOS agent log levels for the agent and remote logging.
17+
18+
### Agent Log Level
19+
20+
The agent log level is configured in the New Relic agent and determines which log messages are written to the device's console. This also includes the New Relic agent logs. To view all New Relic agent logs, set the log level to `NRLogLevelDebug`.
21+
22+
23+
### Remote Log Level
24+
25+
In the New Relic platform, the remote log level controls the verbosity of logs sent from a device to New Relic. This helps to manage the data volume and keeps the focus on relevant information.
26+
27+
**Configuration**: On the New Relic dashboard, you can set up the remote log level in <DNT>**Application**</DNT> tab. For more information on setting the remote log level, refer [mobile logs](/docs/mobile-monitoring/mobile-monitoring-ui/mobile-logs).
28+
29+
30+
31+
## Automatic log collection
32+
33+
In the New Relic platform, when the remote logging is enabled, the iOS agent collects all logs written on `stdout` and `stderr` from the app. It captures all calls to `NSLog()`, Swift `print()`, and other print-family functions. The logs collected this way are set to `NRLogLevelInfo`. This feature is disabled by default. To enable it, use the `NRFeatureFlag_AutoCollectLogs` feature flag.
34+
35+
The agent separates log messages using a `'\n\n'` delimiter. The timestamp reflects when the agent collected the log, not when the application wrote it. This might cause difference of milliseconds as the log message was buffered before being collected by the agent.
36+
37+
<Callout variant="important">
38+
This feature interferes with Xcode's built-in console, so it can not be enabled while the debugger is attached.
39+
</Callout>
40+

src/content/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/configure-settings.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,39 @@ NewRelic.enableFeatures([NRMAFeatureFlags.NRFeatureFlag_BackgroundReporting])
11511151
</tr>
11521152
</tbody>
11531153
</table>
1154+
1155+
## Automatic log collection [#ios-log-collection]
1156+
1157+
<table>
1158+
<thead>
1159+
<tr>
1160+
<th style={{ width: "800px" }}>
1161+
Description
1162+
</th>
1163+
1164+
<th>
1165+
Example
1166+
</th>
1167+
</tr>
1168+
</thead>
1169+
1170+
<tbody>
1171+
<tr>
1172+
<td>
1173+
Enable or disable the collection of `stdout` & `stderr` for remote logging.
1174+
</td>
1175+
1176+
<td>
1177+
Log collection is disabled by default. To enable it, add the following feature flag:
1178+
1179+
```swift
1180+
NewRelic.disableFeatures([NRMAFeatureFlags.NRFeatureFlag_AutoCollectLogs])
1181+
```
1182+
For more information, see [iOS agent logging](/docs/mobile-monitoring/new-relic-mobile-ios/configuration/ios-remote-logging).
1183+
</td>
1184+
</tr>
1185+
</tbody>
1186+
</table>
11541187
</TabsPageItem>
11551188

11561189
<TabsPageItem id="capacitor">
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
subject: iOS agent
3+
releaseDate: '2024-12-04'
4+
version: 7.5.3
5+
downloadLink: 'https://download.newrelic.com/ios_agent/NewRelic_XCFramework_Agent_7.5.3.zip'
6+
---
7+
8+
## Fixed in this release
9+
* The tracked headers set in [addHTTPHeaderTrackingFor](/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/add-tracked-headers) are now correctly added to network request events manually captured using [noticeNetworkRequestForURL](/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/network-request-success).
10+
* Fixed a bug in the new event system that prevented adding an attribute with a key that contain a reserved key string as a prefix.
11+
* Made changes to address the `NRMA__deallocInteractionHistoryList` crash reported by users.
12+
13+
## Other notes
14+
* The iOS agent now supports automatic log collection for remote logging. This feature is limited to `NSLog()`, Swift `print()`, and other print-family functions. To enable it, use the `NRFeatureFlag_AutoCollectLogs` feature flag. For more information on how to enable and configure remote logging, visit our [documentation](/docs/mobile-monitoring/new-relic-mobile-ios/configuration/ios-remote-logging).
15+
* Changed the agent to agent to consistently send the sampled flag as '01' (true) in the W3C Traceparent header to maintain trace continuity with OpenTelemetry agents, which expect '00' (false) for dropped spans and '01' (true) for sampled spans.
16+
17+
## Support statement
18+
19+
* As of iOS agent version 7.4.1, the iOS agent will consolidate previously separate XCFramework and tvOS agents into a singular iOS agent.
20+
* As of this release, the oldest supported version of the [XCFramework](/docs/release-notes/mobile-release-notes/ios-release-notes/xcframework-agent-736) is 7.3.6.

src/nav/mobile-monitoring.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ pages:
7373
pages:
7474
- title: iOS config and feature flags
7575
path: /docs/mobile-monitoring/new-relic-mobile-ios/api-guides/ios-agent-configuration-feature-flags
76+
- title: iOS Logging
77+
path: /docs/mobile-monitoring/new-relic-mobile-ios/configuration/ios-remote-logging
7678
- title: iOS/tvOS crash reporting
7779
path: /docs/mobile-monitoring/new-relic-mobile-ios/configuration/ios-tvos-crash-reporting
7880
- title: Enable Swift interaction traces
@@ -240,6 +242,8 @@ pages:
240242
path: /docs/mobile-monitoring/new-relic-mobile/mobile-sdk/network-request-failures
241243
- title: Track HTTP requests headers
242244
path: /docs/mobile-monitoring/new-relic-mobile/mobile-sdk/add-tracked-headers
245+
- title: Logs page
246+
path: /docs/mobile-monitoring/mobile-monitoring-ui/mobile-logs
243247
- title: Best practices
244248
path: /docs/new-relic-solutions/best-practices-guides/full-stack-observability/mobile-monitoring-best-practices-guide
245249
- title: Overview of app launch times

0 commit comments

Comments
 (0)