Skip to content

Commit 29e8725

Browse files
committed
Provide Gradle example for using Log4j2
Closes gh-12729
1 parent 8a0f035 commit 29e8725

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

spring-boot-docs/src/main/asciidoc/howto.adoc

+18-1
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,7 @@ instead. If you aren't using the starters then you need to provide `jcl-over-slf
16481648
(at least) in addition to Log4j 2.
16491649

16501650
The simplest path is probably through the starters, even though it requires some
1651-
jiggling with excludes, .e.g. in Maven:
1651+
jiggling with excludes. The following example shows how to set up the starters in Maven:
16521652

16531653
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
16541654
----
@@ -1672,6 +1672,23 @@ jiggling with excludes, .e.g. in Maven:
16721672
</dependency>
16731673
----
16741674

1675+
And the following example shows one way to set up the starters in Gradle:
1676+
1677+
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
1678+
----
1679+
dependencies {
1680+
compile 'org.springframework.boot:spring-boot-starter-web'
1681+
compile 'org.springframework.boot:spring-boot-starter-log4j2'
1682+
}
1683+
1684+
configurations {
1685+
all {
1686+
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
1687+
}
1688+
}
1689+
----
1690+
1691+
16751692
NOTE: The use of the Log4j starters gathers together the dependencies for common logging
16761693
requirements (e.g. including having Tomcat use `java.util.logging` but configuring the
16771694
output using Log4j 2). See the Actuator Log4j 2 samples for more detail and to see it in

0 commit comments

Comments
 (0)