Harmonize Undertow's access log properties
Harmonize the configuration properties for Undertow to match the changes made for gh-2491. Move `spring.undertow.accessLog*` to `spring.undertow.accesslog.*`
This commit is contained in:
parent
62406546e2
commit
6c7a5c5077
|
|
@ -467,7 +467,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
|
|||
public static class Tomcat {
|
||||
|
||||
/**
|
||||
* Access log configuration
|
||||
* Access log configuration.
|
||||
*/
|
||||
private final Accesslog accesslog = new Accesslog();
|
||||
|
||||
|
|
@ -846,20 +846,7 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
|
|||
*/
|
||||
private Boolean directBuffers;
|
||||
|
||||
/**
|
||||
* Format pattern for access logs.
|
||||
*/
|
||||
private String accessLogPattern = "common";
|
||||
|
||||
/**
|
||||
* Enable access log.
|
||||
*/
|
||||
private boolean accessLogEnabled = false;
|
||||
|
||||
/**
|
||||
* Undertow access log directory.
|
||||
*/
|
||||
private File accessLogDir = new File("logs");
|
||||
private final Accesslog accesslog = new Accesslog();
|
||||
|
||||
public Integer getBufferSize() {
|
||||
return this.bufferSize;
|
||||
|
|
@ -901,28 +888,74 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
|
|||
this.directBuffers = directBuffers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access log configuration.
|
||||
*/
|
||||
public Accesslog getAccesslog() {
|
||||
return accesslog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the format pattern for access logs.
|
||||
* @return the format pattern for access logs
|
||||
* @deprecated since 1.3.0 in favor of {@code server.undertow.accesslog.pattern}
|
||||
*/
|
||||
@Deprecated
|
||||
@DeprecatedConfigurationProperty(replacement = "server.undertow.accesslog.pattern")
|
||||
public String getAccessLogPattern() {
|
||||
return this.accessLogPattern;
|
||||
return this.accesslog.getPattern();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the format pattern for access logs
|
||||
* @param accessLogPattern the pattern for access logs
|
||||
* @deprecated since 1.3.0 in favor of {@code server.undertow.accesslog.pattern}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setAccessLogPattern(String accessLogPattern) {
|
||||
this.accessLogPattern = accessLogPattern;
|
||||
this.accesslog.setPattern(accessLogPattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify if access log is enabled.
|
||||
* @return {@code true} if access log is enabled
|
||||
* @deprecated since 1.3.0 in favor of {@code server.undertow.accesslog.enabled}
|
||||
*/
|
||||
@Deprecated
|
||||
@DeprecatedConfigurationProperty(replacement = "server.undertow.accesslog.enabled")
|
||||
public boolean isAccessLogEnabled() {
|
||||
return this.accessLogEnabled;
|
||||
return this.accesslog.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if access log is enabled.
|
||||
* @param accessLogEnabled the access log enable flag
|
||||
* @deprecated since 1.3.0 in favor of {@code server.undertow.accesslog.enabled}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setAccessLogEnabled(boolean accessLogEnabled) {
|
||||
this.accessLogEnabled = accessLogEnabled;
|
||||
getAccesslog().setEnabled(accessLogEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the access log directory.
|
||||
* @return the access log directory
|
||||
* @deprecated since 1.3.0 in favor of {@code server.undertow.accesslog.dir}
|
||||
*/
|
||||
@Deprecated
|
||||
@DeprecatedConfigurationProperty(replacement = "server.undertow.accesslog.dir")
|
||||
public File getAccessLogDir() {
|
||||
return this.accessLogDir;
|
||||
return this.accesslog.getDir();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the access log directory.
|
||||
* @param accessLogDir the access log directory
|
||||
* @deprecated since 1.3.0 in favor of {@code server.tomcat.accesslog.dir}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setAccessLogDir(File accessLogDir) {
|
||||
this.accessLogDir = accessLogDir;
|
||||
getAccesslog().setDir(accessLogDir);
|
||||
}
|
||||
|
||||
void customizeUndertow(UndertowEmbeddedServletContainerFactory factory) {
|
||||
|
|
@ -931,9 +964,53 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer, Ord
|
|||
factory.setIoThreads(this.ioThreads);
|
||||
factory.setWorkerThreads(this.workerThreads);
|
||||
factory.setDirectBuffers(this.directBuffers);
|
||||
factory.setAccessLogDirectory(this.accessLogDir);
|
||||
factory.setAccessLogPattern(this.accessLogPattern);
|
||||
factory.setAccessLogEnabled(this.accessLogEnabled);
|
||||
factory.setAccessLogDirectory(this.accesslog.dir);
|
||||
factory.setAccessLogPattern(this.accesslog.pattern);
|
||||
factory.setAccessLogEnabled(this.accesslog.enabled);
|
||||
}
|
||||
|
||||
|
||||
public static class Accesslog {
|
||||
|
||||
/**
|
||||
* Enable access log.
|
||||
*/
|
||||
private boolean enabled = false;
|
||||
|
||||
/**
|
||||
* Format pattern for access logs.
|
||||
*/
|
||||
private String pattern = "common";
|
||||
|
||||
/**
|
||||
* Undertow access log directory.
|
||||
*/
|
||||
private File dir = new File("logs");
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
public void setPattern(String pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public File getDir() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
public void setDir(File dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ content into your application; rather pick only the properties that you need.
|
|||
server.tomcat.max-http-header-size= # maximum size in bytes of the HTTP message header
|
||||
server.tomcat.max-threads = 0 # number of threads in protocol handler
|
||||
server.tomcat.uri-encoding = UTF-8 # character encoding to use for URL decoding
|
||||
server.undertow.access-log-enabled=false # if access logging is enabled
|
||||
server.undertow.access-log-pattern=common # log pattern of the access log
|
||||
server.undertow.access-log-dir=logs # access logs directory
|
||||
server.undertow.accesslog.enabled=false # if access logging is enabled
|
||||
server.undertow.accesslog.pattern=common # log pattern of the access log
|
||||
server.undertow.accesslog.dir=logs # access logs directory
|
||||
server.undertow.buffer-size= # size of each buffer in bytes
|
||||
server.undertow.buffers-per-region= # number of buffer per region
|
||||
server.undertow.direct-buffers=false # allocate buffers outside the Java heap
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
server.undertow.access-log-enabled=true
|
||||
server.undertow.access-log-dir=target/logs
|
||||
server.undertow.access-log-pattern=combined
|
||||
server.undertow.accesslog.enabled=true
|
||||
server.undertow.accesslog.dir=target/logs
|
||||
server.undertow.accesslog.pattern=combined
|
||||
server.compression.enabled=true
|
||||
server.compression.min-response-size=1
|
||||
Loading…
Reference in New Issue