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.
Edit the sampling rate to specify the percentage of user sessions to collect logs. You can enter a value between 0 and 100.
Important
The default sampling rate for browser logging is set to 10% of user sessions. You can set this session sampling rate anywhere between 0%
to 100%
. For example, setting the session sampling rate to 50%
will result in log event collection from approximately half of randomly selected user sessions.
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.

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.