@@ -507,6 +507,35 @@ the two to configure programmatically. See the
507
507
{github-code}/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors[`spring-boot-sample-tomcat-multi-connectors`]
508
508
sample project for an example.
509
509
510
+ [[howto-configure-accesslogs]]
511
+ === Configure Access Logging
512
+ Access logs can be configured for Tomcat and Undertow via their respective namespaces.
513
+
514
+ For instance, the following logs access on Tomcat with a
515
+ https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#Access_Logging[custom pattern].
516
+
517
+ [source,properties,indent=0,subs="verbatim,quotes,attributes"]
518
+ ----
519
+ server.tomcat.basedir=my-tomcat
520
+ server.tomcat.accesslog.enabled=true
521
+ server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms)
522
+ ----
523
+
524
+ NOTE: The default location for logs is a `logs` directory relative to the tomcat base dir
525
+ and said directory is a temp directory by default so you may want to fix Tomcat's base
526
+ directory or use an absolute path for the logs. In the example above, the logs will
527
+ be available in `my-tomcat/logs` relative to the working directory of the application.
528
+
529
+ Access logging for undertow can be configured in a similar fashion
530
+
531
+ [source,properties,indent=0,subs="verbatim,quotes,attributes"]
532
+ ----
533
+ server.undertow.accesslog.enabled=true
534
+ server.undertow.accesslog.pattern=%t %a "%r" %s (%D ms)
535
+ ----
536
+
537
+ Logs are stored in a `logs` directory relative to the working directory of the
538
+ application. This can be customized via `server.undertow.accesslog.directory`.
510
539
511
540
512
541
[[howto-use-behind-a-proxy-server]]
0 commit comments