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
41f0a5cd
Commit
41f0a5cd
authored
Feb 29, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.3.x'
parents
cd6cacfb
4eda91d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
LoggingApplicationListener.java
...ingframework/boot/logging/LoggingApplicationListener.java
+5
-6
LoggingApplicationListenerTests.java
...amework/boot/logging/LoggingApplicationListenerTests.java
+11
-0
No files found.
spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
View file @
41f0a5cd
...
...
@@ -247,16 +247,18 @@ public class LoggingApplicationListener implements GenericApplicationListener {
*/
protected
void
initialize
(
ConfigurableEnvironment
environment
,
ClassLoader
classLoader
)
{
setSystemProperties
(
environment
);
LogFile
logFile
=
LogFile
.
get
(
environment
);
setSystemProperties
(
environment
,
logFile
);
if
(
logFile
!=
null
)
{
logFile
.
applyToSystemProperties
();
}
initializeEarlyLoggingLevel
(
environment
);
initializeSystem
(
environment
,
this
.
loggingSystem
,
logFile
);
initializeFinalLoggingLevels
(
environment
,
this
.
loggingSystem
);
registerShutdownHookIfNecessary
(
environment
,
this
.
loggingSystem
);
}
private
void
setSystemProperties
(
ConfigurableEnvironment
environment
,
LogFile
logFile
)
{
private
void
setSystemProperties
(
ConfigurableEnvironment
environment
)
{
RelaxedPropertyResolver
propertyResolver
=
new
RelaxedPropertyResolver
(
environment
,
"logging."
);
setSystemProperty
(
propertyResolver
,
EXCEPTION_CONVERSION_WORD
,
...
...
@@ -265,9 +267,6 @@ public class LoggingApplicationListener implements GenericApplicationListener {
setSystemProperty
(
propertyResolver
,
FILE_LOG_PATTERN
,
"pattern.file"
);
setSystemProperty
(
propertyResolver
,
LOG_LEVEL_PATTERN
,
"pattern.level"
);
setSystemProperty
(
PID_KEY
,
new
ApplicationPid
().
toString
());
if
(
logFile
!=
null
)
{
logFile
.
applyToSystemProperties
();
}
}
private
void
setSystemProperty
(
RelaxedPropertyResolver
propertyResolver
,
...
...
spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java
View file @
41f0a5cd
...
...
@@ -35,6 +35,7 @@ import org.junit.rules.ExpectedException;
import
org.junit.rules.TemporaryFolder
;
import
org.slf4j.bridge.SLF4JBridgeHandler
;
import
org.springframework.boot.ApplicationPid
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.context.event.ApplicationStartedEvent
;
import
org.springframework.boot.logging.java.JavaLoggingSystem
;
...
...
@@ -430,6 +431,16 @@ public class LoggingApplicationListenerTests {
assertThat
(
System
.
getProperty
(
"PID"
)).
isNotNull
();
}
@Test
public
void
logFilePropertiesCanReferenceSystemProperties
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"logging.file=target/${PID}.log"
);
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
context
.
getClassLoader
());
assertThat
(
System
.
getProperty
(
"LOG_FILE"
))
.
isEqualTo
(
"target/"
+
new
ApplicationPid
().
toString
()
+
".log"
);
}
private
boolean
bridgeHandlerInstalled
()
{
Logger
rootLogger
=
LogManager
.
getLogManager
().
getLogger
(
""
);
Handler
[]
handlers
=
rootLogger
.
getHandlers
();
...
...
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