Skip to content

Commit

Permalink
Update java-configure-logs-context-all.mdx
Browse files Browse the repository at this point in the history
spring
  • Loading branch information
barbnewrelic committed Aug 27, 2021
1 parent c5a5cc7 commit ea60bbd
Showing 1 changed file with 27 additions and 1 deletion.
Expand Up @@ -479,7 +479,33 @@ We offer a [Logback](https://logback.qos.ch/documentation.html) extension for lo
title="Spring and Springboot"
>
text
We offer extensions for current versions of [Spring](https://spring.io/) and [Spring Boot](https://spring.io/projects/spring-boot). If you already know the logging library, you can skip directly to that documentation:
* [java.util.logging](#java-util-logging)
* [log4j 1](#java-log4j-1x)
* [log4j 2](#java-log4j-2x)
* [logback](#java-logback)
The extensions support default configurations only on Spring Boot 2.0 and higher.
**With Spring Boot:**
Here are tips to determine which logging library you have:
* If you have `spring-boot-starter-log4j2` in your dependencies, you're using **log4j 2.x**. Refer to the [Spring Boot log4j 2.x documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-configure-log4j-for-logging) for basic configuration, and the [New Relic log4j 2 extension](#java-log4j-2x) for customizing your configuration.
* If you're using Spring Boot but **not** the starter-log4j2, you're using **logback** by default. Refer to [Spring Boot logback documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-configure-logback-for-logging) for basic configuration, and the [New Relic logback extension](#logback) for customizing your configuration.
** With Spring (but not Spring Boot):**
Spring 5 or higher:
Spring implements a [bridge](https://docs.spring.io/spring/docs/current/javadoc-api/org/apache/commons/logging/LogFactory.html) to other logging libraries that will automatically find them. However, those individual libraries must be configured and explicitly included in your project dependencies.
To identify your logging dependency, consult your [Gradle](https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html), [Maven](https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html), or other build tool's dependency tree. Then follow the procedures to configure logs in context for your Java app with that extension.
Spring 4 or lower:
Spring version 4 and lower uses [Apache Commons Logging](https://commons.apache.org/proper/commons-logging/guide.html) for its bridge. Refer to the [Spring documentation](https://docs.spring.io/spring/docs/4.3.12.RELEASE/spring-framework-reference/html/overview.html#overview-logging) for information on configuring its bridge.
</Collapser>
Expand Down

0 comments on commit ea60bbd

Please sign in to comment.