• /
  • EnglishEspañolFrançais日本語한국어Português
  • EntrarComeçar agora

Java agent configuration: Config file

|View as Markdown (English)

The New Relic Java agent reads its configuration from the newrelic.yml file. By default the agent looks for this file in the directory that contains newrelic.jar. You can override the config file's location by setting the newrelic.config.file system property to a fully qualified file name.

You'll be able to configure our Java agent to suit your environment after you create a New Relic account (it's free, forever) and install the Java agent.

Configuration file structure

The newrelic.yml file has separate sections for different environments:

  • Test
  • Development
  • Staging
  • Production (default)

New Relic applies settings in the common section to each of these environments. You can select other environments as the default by setting the newrelic.environment system property to the environment name.

Dica

A newrelic.yml template is available.

If you edit newrelic.yml, be careful to conform to the YAML format. Use a YAML validator to ensure the syntax is accurate before using the file with New Relic's Java agent, and follow these rules:

Java agent newrelic.yml

Requirements

Format

YML files are case sensitive.

Indentations

All indentations must be in increments of two characters. Other indentations will result in an Unable to parse configuration file error upon agent startup.

  • Use the same level of indentation for data in the same section of the file.
  • Indent any sub-sections by an additional two spaces.

Changes to file

You must restart your JVM host process for changes to take effect.

Exception: Property changes to log_level and audit_mode do not require a restart. Property changes under circuit breaker don't require a restart.

Configuration settings precedence

To override any setting in the config file, use a system property override. In certain environments, environment variables can also be used to override both the config file and the system properties. The environment variables primarily exist to support Heroku. When used, server-side configuration overrides all other configuration settings.

java-config-order.png

With the Java agent, server-side configuration overrides all other settings. Environment variables override Java system properties. Java properties override user configuration settings in your newrelic.yml file. User settings override the newrelic.yml default settings.

Configuring the Java extensions directory

The Java agent reads the configuration files on process startup. To identify the directory where the files are located, either create a new or specify an existing extensions directory:

Settings index

The following pages contain the full settings reference for each configuration area:

Settings pageDescription
General settingsCore settings: license key, app name, proxy, high security, extensions
Transaction tracer settingsTransaction tracing, SQL capture, transaction events, segments, message tracer
Error collector settingsError collection, ignore/expected classes and status codes, errors inbox
Distributed tracing settingsDistributed tracing, Infinite Tracing, span events, cross application tracer
Logs in context settingsLog forwarding, log metrics, local decorating, logging configuration
Attributes settingsAttribute filtering, include/exclude lists, HTTP attribute mode
Security settingsIAST security agent, vulnerability detection settings
AI monitoring settingsAI monitoring and LLM content recording
Browser monitoring settingsBrowser agent auto-instrumentation and attribute configuration
Async instrumentation settingsAsync token and segment timeout configuration
OpenTelemetry settingsOpenTelemetry traces, metrics, and logs signal configuration
JFR settingsJava Flight Recorder real-time profiling
Class transformer settingsSpring transaction naming, trace annotations, lambda tracing
JMX settingsJMX monitoring and linking metadata
Other settingsCircuit breaker, cloud config, utilization, custom events, jar collector, JVM obfuscation, thread profiler, and more

Importante

The two settings you must configure are your app name and license key — set via app_name and license_key in newrelic.yml (or the NEW_RELIC_APP_NAME and NEW_RELIC_LICENSE_KEY environment variables). All other settings are optional.

Copyright © 2026 New Relic Inc.

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