Polish contribution
Closes gh-8474
This commit is contained in:
@@ -1061,6 +1061,11 @@ public class ServerProperties
|
|||||||
*/
|
*/
|
||||||
private boolean renameOnRotate;
|
private boolean renameOnRotate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date format to place in log file name.
|
||||||
|
*/
|
||||||
|
private String fileDateFormat = ".yyyy-MM-dd";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set request attributes for IP address, Hostname, protocol and port used for
|
* Set request attributes for IP address, Hostname, protocol and port used for
|
||||||
* the request.
|
* the request.
|
||||||
@@ -1072,11 +1077,6 @@ public class ServerProperties
|
|||||||
*/
|
*/
|
||||||
private boolean buffered = true;
|
private boolean buffered = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* Customized date format in the access log file name.
|
|
||||||
*/
|
|
||||||
private String fileDateFormat = "yyyy-MM-dd";
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return this.enabled;
|
return this.enabled;
|
||||||
}
|
}
|
||||||
@@ -1133,6 +1133,14 @@ public class ServerProperties
|
|||||||
this.renameOnRotate = renameOnRotate;
|
this.renameOnRotate = renameOnRotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileDateFormat() {
|
||||||
|
return this.fileDateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileDateFormat(String fileDateFormat) {
|
||||||
|
this.fileDateFormat = fileDateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRequestAttributesEnabled() {
|
public boolean isRequestAttributesEnabled() {
|
||||||
return this.requestAttributesEnabled;
|
return this.requestAttributesEnabled;
|
||||||
}
|
}
|
||||||
@@ -1149,13 +1157,6 @@ public class ServerProperties
|
|||||||
this.buffered = buffered;
|
this.buffered = buffered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileDateFormat() {
|
|
||||||
return fileDateFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileDateFormat(String fileDateFormat) {
|
|
||||||
this.fileDateFormat = fileDateFormat;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public class ServerPropertiesTests {
|
|||||||
bindProperties(map);
|
bindProperties(map);
|
||||||
this.properties.customize(tomcatContainer);
|
this.properties.customize(tomcatContainer);
|
||||||
assertThat(((AccessLogValve) tomcatContainer.getEngineValves().iterator().next())
|
assertThat(((AccessLogValve) tomcatContainer.getEngineValves().iterator().next())
|
||||||
.getFileDateFormat()).isEqualTo("yyyy-MM-dd");
|
.getFileDateFormat()).isEqualTo(".yyyy-MM-dd");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -183,17 +183,6 @@ public class ServerPropertiesTests {
|
|||||||
.getFileDateFormat()).isEqualTo("yyyy-MM-dd.HH");
|
.getFileDateFormat()).isEqualTo("yyyy-MM-dd.HH");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
|
||||||
public void tomcatAccessLogFileDateFormatWrongFormat() {
|
|
||||||
TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory();
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
|
||||||
map.put("server.tomcat.accesslog.enabled", "true");
|
|
||||||
map.put("server.tomcat.accesslog.file-date-format",
|
|
||||||
"this-is-obviously-a-wrong-format");
|
|
||||||
bindProperties(map);
|
|
||||||
this.properties.customize(tomcatContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tomcatAccessLogIsBufferedByDefault() {
|
public void tomcatAccessLogIsBufferedByDefault() {
|
||||||
TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory();
|
TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory();
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ content into your application; rather pick only the properties that you need.
|
|||||||
server.tomcat.accesslog.buffered=true # Buffer output such that it is only flushed periodically.
|
server.tomcat.accesslog.buffered=true # Buffer output such that it is only flushed periodically.
|
||||||
server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be relative to the tomcat base dir or absolute.
|
server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be relative to the tomcat base dir or absolute.
|
||||||
server.tomcat.accesslog.enabled=false # Enable access log.
|
server.tomcat.accesslog.enabled=false # Enable access log.
|
||||||
server.tomcat.accesslog.file-date-format=yyyy-MM-dd # Customized date format in the access log file name.
|
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd # Date format to place in log file name.
|
||||||
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user