Merge branch '1.4.x' into 1.5.x

# Conflicts:
#	spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
#	spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
pull/6961/merge
Stephane Nicoll 8 years ago
commit 2ba3b27954

@ -977,6 +977,8 @@ public class ServerProperties
valve.setPrefix(this.accesslog.getPrefix()); valve.setPrefix(this.accesslog.getPrefix());
valve.setSuffix(this.accesslog.getSuffix()); valve.setSuffix(this.accesslog.getSuffix());
valve.setRenameOnRotate(this.accesslog.isRenameOnRotate()); valve.setRenameOnRotate(this.accesslog.isRenameOnRotate());
valve.setRequestAttributesEnabled(
this.accesslog.isRequestAttributesEnabled());
valve.setRotatable(this.accesslog.isRotate()); valve.setRotatable(this.accesslog.isRotate());
factory.addEngineValves(valve); factory.addEngineValves(valve);
} }
@ -1032,6 +1034,12 @@ public class ServerProperties
*/ */
private boolean renameOnRotate; private boolean renameOnRotate;
/**
* Set request attributes for IP address, Hostname, protocol and port used
* for the request.
*/
private boolean requestAttributesEnabled;
public boolean isEnabled() { public boolean isEnabled() {
return this.enabled; return this.enabled;
} }
@ -1088,6 +1096,14 @@ public class ServerProperties
this.renameOnRotate = renameOnRotate; this.renameOnRotate = renameOnRotate;
} }
public boolean isRequestAttributesEnabled() {
return this.requestAttributesEnabled;
}
public void setRequestAttributesEnabled(boolean requestAttributesEnabled) {
this.requestAttributesEnabled = requestAttributesEnabled;
}
} }
} }

@ -139,6 +139,7 @@ public class ServerPropertiesTests {
map.put("server.tomcat.accesslog.prefix", "foo"); map.put("server.tomcat.accesslog.prefix", "foo");
map.put("server.tomcat.accesslog.rotate", "false"); map.put("server.tomcat.accesslog.rotate", "false");
map.put("server.tomcat.accesslog.rename-on-rotate", "true"); map.put("server.tomcat.accesslog.rename-on-rotate", "true");
map.put("server.tomcat.accesslog.request-attributes-enabled", "true");
map.put("server.tomcat.accesslog.suffix", "-bar.log"); map.put("server.tomcat.accesslog.suffix", "-bar.log");
map.put("server.tomcat.protocol_header", "X-Forwarded-Protocol"); map.put("server.tomcat.protocol_header", "X-Forwarded-Protocol");
map.put("server.tomcat.remote_ip_header", "Remote-Ip"); map.put("server.tomcat.remote_ip_header", "Remote-Ip");
@ -150,6 +151,7 @@ public class ServerPropertiesTests {
assertThat(tomcat.getAccesslog().getPrefix()).isEqualTo("foo"); assertThat(tomcat.getAccesslog().getPrefix()).isEqualTo("foo");
assertThat(tomcat.getAccesslog().isRotate()).isFalse(); assertThat(tomcat.getAccesslog().isRotate()).isFalse();
assertThat(tomcat.getAccesslog().isRenameOnRotate()).isTrue(); assertThat(tomcat.getAccesslog().isRenameOnRotate()).isTrue();
assertThat(tomcat.getAccesslog().isRequestAttributesEnabled()).isTrue();
assertThat(tomcat.getAccesslog().getSuffix()).isEqualTo("-bar.log"); assertThat(tomcat.getAccesslog().getSuffix()).isEqualTo("-bar.log");
assertThat(tomcat.getRemoteIpHeader()).isEqualTo("Remote-Ip"); assertThat(tomcat.getRemoteIpHeader()).isEqualTo("Remote-Ip");
assertThat(tomcat.getProtocolHeader()).isEqualTo("X-Forwarded-Protocol"); assertThat(tomcat.getProtocolHeader()).isEqualTo("X-Forwarded-Protocol");

@ -199,6 +199,7 @@ content into your application; rather pick only the properties that you need.
server.tomcat.accesslog.pattern=common # Format pattern for access logs. server.tomcat.accesslog.pattern=common # Format pattern for access logs.
server.tomcat.accesslog.prefix=access_log # Log file name prefix. server.tomcat.accesslog.prefix=access_log # Log file name prefix.
server.tomcat.accesslog.rename-on-rotate=false # Defer inclusion of the date stamp in the file name until rotate time. server.tomcat.accesslog.rename-on-rotate=false # Defer inclusion of the date stamp in the file name until rotate time.
server.tomcat.accesslog.request-attributes-enabled=false # Set request attributes for IP address, Hostname, protocol and port used for the request.
server.tomcat.accesslog.rotate=true # Enable access log rotation. server.tomcat.accesslog.rotate=true # Enable access log rotation.
server.tomcat.accesslog.suffix=.log # Log file name suffix. server.tomcat.accesslog.suffix=.log # Log file name suffix.
server.tomcat.additional-tld-skip-patterns= # Comma-separated list of additional patterns that match jars to ignore for TLD scanning. server.tomcat.additional-tld-skip-patterns= # Comma-separated list of additional patterns that match jars to ignore for TLD scanning.

Loading…
Cancel
Save