Skip to content

Commit ffbd11c

Browse files
committed
Document logger environment variable restrictions
Update the reference guide with a note about using environment variables to configure logging. Closes gh-17958
1 parent 37d3ce0 commit ffbd11c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ On your application classpath (for example, inside your jar) you can have an `ap
370370
When running in a new environment, an `application.properties` file can be provided outside of your jar that overrides the `name`.
371371
For one-off testing, you can launch with a specific command line switch (for example, `java -jar app.jar --name="Spring"`).
372372

373+
[[boot-features-external-config-application-json]]
373374
[TIP]
374375
====
375376
The `SPRING_APPLICATION_JSON` properties can be supplied on the command line with an environment variable.
@@ -1513,11 +1514,18 @@ The following example shows potential logging settings in `application.propertie
15131514

15141515
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
15151516
----
1516-
logging.level.root=WARN
1517-
logging.level.org.springframework.web=DEBUG
1518-
logging.level.org.hibernate=ERROR
1517+
logging.level.root=warn
1518+
logging.level.org.springframework.web=debug
1519+
logging.level.org.hibernate=error
15191520
----
15201521

1522+
It's also possible to set logging levels using environment variables.
1523+
For example, `LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WEB=DEBUG` will set `org.springframework.web` to `DEBUG`.
1524+
1525+
NOTE: The above approach will only work for package level logging.
1526+
Since relaxed binding always converts environment variables to lowercase, it's not possible to configure logging for an individual class in this way.
1527+
If you need to configure logging for a class, you can use <<boot-features-external-config-application-json, the APPLICATION_JSON>> variable.
1528+
15211529

15221530

15231531
[[boot-features-custom-log-groups]]

0 commit comments

Comments
 (0)