Spring Boot Embedded Server Logs

Learn to enable and customize the internal and access logs generated for embedded servers in Spring boot e.g. tomcat, jetty & undertow.

1. Types of Logging for Embedded Servers

Generally, in an application, we would like to categorize the embedded logs into two categories:

1.1. Access logs

Access logs represent information related to the received request, sent response to the client and important details in between when the request was processed.

1.2. Internal logs

Internal logs give logging information internal to how the Tomcat server is running inside the box. It’s more of internal information and does not provide much help until we are facing some issue with the server itself.

2. Access Logs for Embedded Servers

Access logs can be configured for Tomcat, Undertow, and Jetty through their respective namespaces in the properties file.

For instance, the following settings will enable access logs with a custom pattern [more info].

server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms)

server.undertow.accesslog.pattern=%t %a "%r" %s (%D ms)


The default location for Tomcat logs is a logs directory relative to the Tomcat base directory, which is the temp directory. You can provide the location of generated logs in filesystem by overriding basedir property.

We can find all supported properties for the embedded server’s access logs on this reference page.


server.tomcat.accesslog.buffered=true # Whether to buffer output such that it is flushed only periodically.
server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be absolute or relative to the Tomcat base dir.
server.tomcat.accesslog.enabled=false # Enable access log.
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd # Date format to place in the log file name.
server.tomcat.accesslog.pattern=common # Format pattern for access logs.
server.tomcat.accesslog.prefix=access_log # Log file name prefix.
server.tomcat.accesslog.rename-on-rotate=false # Whether to defer inclusion of the date stamp in the file name until rotate time.
server.tomcat.accesslog.request-attributes-enabled=false # Set request attributes for the IP address, Hostname, protocol, and port used for the request.
server.tomcat.accesslog.rotate=true # Whether to enable access log rotation.
server.tomcat.accesslog.suffix=.log # Log file name suffix.


server.jetty.accesslog.append=false # Append to log.
server.jetty.accesslog.date-format=dd/MMM/yyyy:HH:mm:ss Z # Timestamp format of the request log.
server.jetty.accesslog.enabled=false # Enable access log.
server.jetty.accesslog.extended-format=false # Enable extended NCSA format.
server.jetty.accesslog.file-date-format= # Date format to place in log file name.
server.jetty.accesslog.filename= # Log filename. If not specified, logs redirect to "System.err".
server.jetty.accesslog.locale= # Locale of the request log.
server.jetty.accesslog.log-cookies=false # Enable logging of the request cookies.
server.jetty.accesslog.log-latency=false # Enable logging of request processing time.
server.jetty.accesslog.log-server=false # Enable logging of the request hostname.
server.jetty.accesslog.retention-period=31 # Number of days before rotated log files are deleted.
server.jetty.accesslog.time-zone=GMT # Timezone of the request log.


server.undertow.accesslog.dir= # Undertow access log directory.
server.undertow.accesslog.enabled=false # Whether to enable the access log.
server.undertow.accesslog.pattern=common # Format pattern for access logs.
server.undertow.accesslog.prefix=access_log. # Log file name prefix.
server.undertow.accesslog.rotate=true # Whether to enable access log rotation.
server.undertow.accesslog.suffix=log # Log file name suffix.

3. Internal Logs for Embedded Servers

To generate internal logging for the embedded server in spring boot, we need to define logging level for the server component.






Drop me your questions related to how to enable and customize the server logs for embedded servers (tomcat, jetty and Undertow) in spring boot applications.

Happy Learning !!


Notify of
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.