New Relic offers extensions for log management that are compatible with current versions of Spring and Spring Boot. If you use Spring, read on to learn how to enable New Relic's logs in context and enrich your log data.
If you already know the logging library, you can skip directly to that documentation:
To use New Relic logs in context with Logback, ensure your configuration meets the following requirements:
The extensions support default configurations only on Spring Boot 2.0 and higher.
For users of Spring Boot, here are tips for determining which logging library you have:
- If you have
spring-boot-starter-log4j2in your dependencies, you're using log4j 2.x. Refer to the Spring Boot log4j 2.x documentation for basic configuration, and the New Relic log4j 2 extension for customizing configuration for New Relic Logs.
- If you're using Spring Boot but not the starter-log4j2, you're using logback by default. Refer to Spring Boot logback documentation for basic configuration, and the New Relic logback extension for customizing it for New Relic Logs.
Spring 5 or higher:
- Spring implements a bridge to other logging libraries that will automatically find them. However, those individual libraries must be configured and explicitly included in your project dependencies. Consult your Gradle, Maven, or other build tool's dependency tree to identify your logging dependency. Then visit the individual library page for more information.
Spring 4 or lower: