diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index be811a0da7..3acaa21388 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -507,6 +507,35 @@ the two to configure programmatically. See the {github-code}/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors[`spring-boot-sample-tomcat-multi-connectors`] sample project for an example. +[[howto-configure-accesslogs]] +=== Configure Access Logging +Access logs can be configured for Tomcat and Undertow via their respective namespaces. + +For instance, the following logs access on Tomcat with a +https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#Access_Logging[custom pattern]. + +[source,properties,indent=0,subs="verbatim,quotes,attributes"] +---- + server.tomcat.basedir=my-tomcat + server.tomcat.accesslog.enabled=true + server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms) +---- + +NOTE: The default location for logs is a `logs` directory relative to the tomcat base dir +and said directory is a temp directory by default so you may want to fix Tomcat's base +directory or use an absolute path for the logs. In the example above, the logs will +be available in `my-tomcat/logs` relative to the working directory of the application. + +Access logging for undertow can be configured in a similar fashion + +[source,properties,indent=0,subs="verbatim,quotes,attributes"] +---- + server.undertow.accesslog.enabled=true + server.undertow.accesslog.pattern=%t %a "%r" %s (%D ms) +---- + +Logs are stored in a `logs` directory relative to the working directory of the +application. This can be customized via `server.undertow.accesslog.directory`. [[howto-use-behind-a-proxy-server]] diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index c31be06552..33fb12926b 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -1890,11 +1890,22 @@ file. Common server settings include: -* `server.port` -- The listen port for incoming HTTP requests. -* `server.address` -- The interface address to bind to. -* `server.session.timeout` -- A session timeout. - -See the {sc-spring-boot-autoconfigure}/web/ServerProperties.{sc-ext}[`ServerProperties`] +* Network settings: listen port for incoming HTTP requests (`server.port`), interface +address to bind to `server.address`, etc. +* Session settings: whether the session is persistent (`server.session.persistence`), +session timeout (`server.session.timeout`), location of session data +(`server.session.store-dir`) and session-cookie configuration (`server.session.cookie.*`). +* Error management: location of the error page (`server.error.path`), etc. +* <> +* <> + +Spring Boot tries as much as possible to expose common settings but this is not always +possible. For those cases, dedicated namespaces offer server-specific customizations (see +`server.tomcat` and `server.undertow`). For instance, +<> can be configured with specific +features of the embedded servlet container. + +TIP: See the {sc-spring-boot-autoconfigure}/web/ServerProperties.{sc-ext}[`ServerProperties`] class for a complete list.