Add support for configuring Jetty's request log via the environment

Closes gh-8819
This commit is contained in:
Stephane Nicoll
2017-04-27 10:41:39 +02:00
parent ce892a06e4
commit f5db75792e
6 changed files with 186 additions and 101 deletions

View File

@@ -157,22 +157,20 @@ content into your application; rather pick only the properties that you need.
server.error.path=/error # Path of the error controller.
server.error.whitelabel.enabled=true # Enable the default error page displayed in browsers in case of a server error.
server.jetty.acceptors= # Number of acceptor threads to use.
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 will be redirected 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.jetty.max-http-post-size=0 # Maximum size in bytes of the HTTP post or put content.
server.jetty.selectors= # Number of selector threads to use.
server.jetty.accesslog.enabled=false # Enable access log.
server.jetty.accesslog.filename= # Filename of Jetty access logs.
server.jetty.accesslog.retainDays=31 # number of days before rotated log files are deleted.
server.jetty.accesslog.append=true # append to log flag.
server.jetty.accesslog.filenameDateFormat=yyyy_MM_dd # log file name date format.
server.jetty.accesslog.extended= true # extended request log format flag.
server.jetty.accesslog.logTimeZone= GMT # the timezone of the request log
server.jetty.accesslog.logCookies=false # Controls logging of the request cookies.
server.jetty.accesslog.logServer=false # Controls logging of the request hostname.
server.jetty.accesslog.logLatency=false # Controls logging of request processing time.
server.jetty.accesslog.logDateFormat= # Set the timestamp format for request log entries in the file. If this is not set, the pre-formated request timestamp is used.
server.jsp-servlet.class-name=org.apache.jasper.servlet.JspServlet # The class name of the JSP servlet.
server.jsp-servlet.init-parameters.*= # Init parameters used to configure the JSP servlet
server.jsp-servlet.registered=true # Whether or not the JSP servlet is registered
server.port=8080 # Server HTTP port.
server.server-header= # Value to use for the Server response header (no header is sent if empty)
server.use-forward-headers= # If X-Forwarded-* headers should be applied to the HttpRequest.

View File

@@ -636,7 +636,8 @@ sample project for an example.
[[howto-configure-accesslogs]]
=== Configure Access Logging
Access logs can be configured for Tomcat, Undertow and Jetty via their respective namespaces.
Access logs can be configured for Tomcat, Undertow and Jetty 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].
@@ -664,16 +665,17 @@ Access logging for undertow can be configured in a similar fashion
Logs are stored in a `logs` directory relative to the working directory of the
application. This can be customized via `server.undertow.accesslog.directory`.
Access logging for jetty can be configured in a similar fashion
Finally, access logging for jetty can also be configured that way:
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
----
server.jetty.accesslog.enabled=true
server.jetty.accesslog.filename=
server.jetty.accesslog.filename=access-log
----
If no filename logs will go to System.err.
For more details please refer to https://www.eclipse.org/jetty/documentation/9.3.x/configuring-jetty-request-logs.html.
By default, logs will be redirected to `System.err`. For more details, please refer to
https://www.eclipse.org/jetty/documentation/9.3.x/configuring-jetty-request-logs.html[the documentation].
[[howto-use-behind-a-proxy-server]]