• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

Java agent general settings

|View as Markdown (English)

General settings are the core configuration options for the Java agent, including license key, application name, logging, proxy, and high security mode.

Conseil

Back to the full settings index: Java agent configuration

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.

Conseil

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:

General configuration settings

Set these options in the common section. To override any of these options, use a newrelic.config prefixed system property.

Environment variables

Environment variables take the highest precedence and override the system properties and yml config settings.

  • To set environment variables, use the export VARNAME=value command.
  • To permanently set environment variables, add the export line to a file such as ~/.bashrc or ~/.bash_profile.

You can override any setting from a system property or in the newrelic.yml by setting an environment variable. The environment variable corresponding to a given setting in the config file is the setting name prefixed by NEW_RELIC with all dots (.) and dashes (-) replaced by underscores (_). For example, the environment variable for the log_level setting is NEW_RELIC_LOG_LEVEL.

For settings nested in sections, prepend the section name to the setting name. For example:

class_transformer:
com.newrelic.instrumentation.kafka-clients-spans-0.11.0.0:
enabled: true

The configuration above would convert to the following environment variable: NEW_RELIC_CLASS_TRANSFORMER_COM_NEWRELIC_INSTRUMENTATION_KAFKA_CLIENTS_SPANS_0_11_0_0_ENABLED

Important

Agent configuration via environment variables requires Java agent version 4.10.0 or higher.

System properties

You can override any setting in the newrelic.yml file by setting a system property. The system property corresponding to a given setting in the config file is the setting name prefixed by newrelic.config. For example, the system property for the log_level setting is newrelic.config.log_level.

For settings nested in sections, prepend the section name to the setting name. For example, the system property for the enabled setting in the transaction_tracer section is newrelic.config.transaction_tracer.enabled.

In addition to overriding configuration settings, the agent recognizes these system properties:

Droits d'auteur © 2026 New Relic Inc.

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