From 6941d0e84b14b66afe2cee46a993cb70836624c1 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 16 Jul 2024 08:45:01 +0100 Subject: [PATCH] Document that logging.file.path if logging.file.name is set Closes gh-41351 --- .../src/docs/asciidoc/features/logging.adoc | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/logging.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/logging.adoc index a206537903e..4cb432e8753 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/logging.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/logging.adoc @@ -125,30 +125,33 @@ The following colors and styles are supported: === File Output By default, Spring Boot logs only to the console and does not write log files. If you want to write log files in addition to the console output, you need to set a configprop:logging.file.name[] or configprop:logging.file.path[] property (for example, in your `application.properties`). +If both properties are set, `logging.file.path` is ignored and only `logging.file.name` is used. The following table shows how the `logging.*` properties can be used together: .Logging properties -[cols="1,1,1,4"] +[cols="1,1,4"] |=== -| configprop:logging.file.name[] | configprop:logging.file.path[] | Example | Description +| configprop:logging.file.name[] | configprop:logging.file.path[] | Description | _(none)_ | _(none)_ -| | Console only logging. -| Specific file +| Specific file (for example, `my.log`) | _(none)_ -| `my.log` -| Writes to the specified log file. - Names can be an exact location or relative to the current directory. +| Writes to the location specified by `logging.file.name`. + The location can be absolute or relative to the current directory. | _(none)_ +| Specific directory (for example, `/var/log`) +| Writes `spring.log` to the directory specified by `logging.file.path`. + The directory can be absolute or relative to the current directory. + +| Specific file | Specific directory -| `/var/log` -| Writes `spring.log` to the specified directory. - Names can be an exact location or relative to the current directory. +| Writes to the location specified by `logging.file.name` and ignores `logging.file.path`. + The location can be absolute or relative to the current directory. |=== Log files rotate when they reach 10 MB and, as with console output, `ERROR`-level, `WARN`-level, and `INFO`-level messages are logged by default.