Automatically detect browser logs
Auto logging collects log messages issued from the browser console
to help you maximize observability of your front-end applications.
Browser logs are tracked by default at the WARN
level for Pro and Pro+SPA agents, but unavailable for the Lite browser agent. We recommend that you first confirm you're using the Pro or Pro+SPA agent
.
How browser auto-logging works
Based on logging levels and sampling rates set in the configuration, auto-instrumentation of browser logs will attempt to collect messages from the following methods:
Method | Level |
---|---|
console.log |
|
console.error |
|
console.warn |
|
console.info |
|
console.debug |
|
console.trace |
|
By default, logging data is stored for 30 days, but actual data retention depends on your account.
Prerequisites
- A Pro or Pro + SPA browser agent
Important
Automatic log detection is not available for the Lite browser agent.
Enable automatic log collection (For Existing Browser Apps)
Enhance your application's observability and debugging capabilities by following these simple setup instructions.
Go to one.newrelic.com > All Capabilities > Browser.
Select your browser app.
In the left-hand menu, click Application settings.
Ensure the Pro or Pro + SPA browser agent is selected.
Toggle Browser Logs to ON.
Toggle the required verbosity level to ON, you can choose from:
Error
Warn
Info
Debug
Trace
Important
Data passed through the console methods may go through serialization and obfuscation. Depending on the size and frequency, this may negatively impact application performance as well as data costs. In general, it is NOT recommended to pass in large objects or large amounts of data into console methods.
Edit the sampling rate to specify the percentage of user sessions for which to collect logs. You can enter a value between 0 and 100.
Important
- Logs sampling is coordinated with other sampling decisions to maximize data collection for the same session. For example, if you set the logs sampling rate to 5% and your Session Replay (SR) sampling rate to 10%, then:
- Roughly 5% of your sessions will have both Logs and SR collected.
- Roughly 5% of your sessions will have only SR data collected.
- The remaining sessions will have neither.
- For any new browser apps you create, automatic log collection is enabled by default with a warn verbosity level and a sampling rate of 100%.

Disable browser logs
To disable browser logs for an existing browser app:
Go to one.newrelic.com > All Capabilities > Browser.
Select your browser app.
In the left-hand menu, click Application settings.
Toggle Browser Logs to OFF.
Data consumption
Logs follow the same consumption pricing as your other browser bytes. The amount of bytes produced depends on the count and length of messages.
The auto logging feature eliminates the need to call the newrelic.log
or newrelic.wrapLogger
browser APIs, except when adding custom attributes to logging events.