diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index c3b3050933..2dac22fb99 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -1251,7 +1251,8 @@ using the "logging.config" property. === Configure Logback for logging If you put a `logback.xml` in the root of your classpath it will be picked up from there -(or `logback-spring.xml` to take advantage of the templating features provided by Boot). Spring Boot provides a default base configuration that you can include if you just +(or `logback-spring.xml` to take advantage of the templating features provided by Boot). +Spring Boot provides a default base configuration that you can include if you just want to set levels, e.g. [source,xml,indent=0,subs="verbatim,quotes,attributes"] @@ -1283,6 +1284,33 @@ If Groovy is on the classpath you should be able to configure Logback with +[[howto-configure-logback-for-logging-fileonly]] +==== Configure logback for file only output +If you want to disable console logging and write output only to a file you need a custom +`spring-logback.xml` that imports `file-appender.xml` but not `console-appender.xml`: + +[source,xml,indent=0,subs="verbatim,quotes,attributes"] +---- + + + + + + + + + +---- + +You also need to add `logging.file` to your `application.properties`: + +[source,properties,indent=0,subs="verbatim,quotes,attributes"] +---- + logging.file=myapplication.log +---- + + + [[howto-configure-log4j-for-logging]] === Configure Log4j for logging Spring Boot also supports either http://logging.apache.org/log4j/1.2[Log4j] or