Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
5ca197b5
Commit
5ca197b5
authored
Mar 10, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
030b5661
cbde6ed0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
0 deletions
+38
-0
DefaultServletContainerCustomizer.java
.../autoconfigure/web/DefaultServletContainerCustomizer.java
+1
-0
ServerProperties.java
...ingframework/boot/autoconfigure/web/ServerProperties.java
+13
-0
DefaultServletContainerCustomizerTests.java
...configure/web/DefaultServletContainerCustomizerTests.java
+23
-0
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+1
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizer.java
View file @
5ca197b5
...
@@ -414,6 +414,7 @@ public class DefaultServletContainerCustomizer
...
@@ -414,6 +414,7 @@ public class DefaultServletContainerCustomizer
valve
.
setPrefix
(
tomcatProperties
.
getAccesslog
().
getPrefix
());
valve
.
setPrefix
(
tomcatProperties
.
getAccesslog
().
getPrefix
());
valve
.
setSuffix
(
tomcatProperties
.
getAccesslog
().
getSuffix
());
valve
.
setSuffix
(
tomcatProperties
.
getAccesslog
().
getSuffix
());
valve
.
setRenameOnRotate
(
tomcatProperties
.
getAccesslog
().
isRenameOnRotate
());
valve
.
setRenameOnRotate
(
tomcatProperties
.
getAccesslog
().
isRenameOnRotate
());
valve
.
setFileDateFormat
(
tomcatProperties
.
getAccesslog
().
getFileDateFormat
());
valve
.
setRequestAttributesEnabled
(
valve
.
setRequestAttributesEnabled
(
tomcatProperties
.
getAccesslog
().
isRequestAttributesEnabled
());
tomcatProperties
.
getAccesslog
().
isRequestAttributesEnabled
());
valve
.
setRotatable
(
tomcatProperties
.
getAccesslog
().
isRotate
());
valve
.
setRotatable
(
tomcatProperties
.
getAccesslog
().
isRotate
());
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
View file @
5ca197b5
...
@@ -653,6 +653,11 @@ public class ServerProperties {
...
@@ -653,6 +653,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.
...
@@ -720,6 +725,14 @@ public class ServerProperties {
...
@@ -720,6 +725,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
;
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerTests.java
View file @
5ca197b5
...
@@ -93,6 +93,29 @@ public class DefaultServletContainerCustomizerTests {
...
@@ -93,6 +93,29 @@ public class DefaultServletContainerCustomizerTests {
.
isInstanceOf
(
AccessLogValve
.
class
);
.
isInstanceOf
(
AccessLogValve
.
class
);
}
}
@Test
public
void
tomcatAccessLogFileDateFormatByDefault
()
{
TomcatEmbeddedServletContainerFactory
tomcatContainer
=
new
TomcatEmbeddedServletContainerFactory
();
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"server.tomcat.accesslog.enabled"
,
"true"
);
bindProperties
(
map
);
this
.
customizer
.
customize
(
tomcatContainer
);
assertThat
(((
AccessLogValve
)
tomcatContainer
.
getEngineValves
().
iterator
().
next
())
.
getFileDateFormat
()).
isEqualTo
(
".yyyy-MM-dd"
);
}
@Test
public
void
tomcatAccessLogFileDateFormatCanBeRedefined
()
{
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"
,
"yyyy-MM-dd.HH"
);
bindProperties
(
map
);
this
.
customizer
.
customize
(
tomcatContainer
);
assertThat
(((
AccessLogValve
)
tomcatContainer
.
getEngineValves
().
iterator
().
next
())
.
getFileDateFormat
()).
isEqualTo
(
"yyyy-MM-dd.HH"
);
}
@Test
@Test
public
void
tomcatAccessLogIsBufferedByDefault
()
{
public
void
tomcatAccessLogIsBufferedByDefault
()
{
TomcatEmbeddedServletContainerFactory
tomcatContainer
=
new
TomcatEmbeddedServletContainerFactory
();
TomcatEmbeddedServletContainerFactory
tomcatContainer
=
new
TomcatEmbeddedServletContainerFactory
();
...
...
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
5ca197b5
...
@@ -195,6 +195,7 @@ content into your application; rather pick only the properties that you need.
...
@@ -195,6 +195,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 # 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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment