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
21897a70
Commit
21897a70
authored
Aug 28, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x'
Closes gh-23136
parents
b70d0dd5
84f281fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
LoggingApplicationListener.java
...work/boot/context/logging/LoggingApplicationListener.java
+7
-3
LoggingApplicationListenerTests.java
...boot/context/logging/LoggingApplicationListenerTests.java
+3
-2
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
View file @
21897a70
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
context
.
logging
;
package
org
.
springframework
.
boot
.
context
.
logging
;
import
java.io.FileNotFoundException
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -53,7 +54,6 @@ import org.springframework.core.env.Environment;
...
@@ -53,7 +54,6 @@ import org.springframework.core.env.Environment;
import
org.springframework.core.log.LogMessage
;
import
org.springframework.core.log.LogMessage
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.ResourceUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
/**
/**
...
@@ -307,13 +307,17 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -307,13 +307,17 @@ public class LoggingApplicationListener implements GenericApplicationListener {
}
}
else
{
else
{
try
{
try
{
ResourceUtils
.
getURL
(
logConfig
).
openStream
().
close
();
system
.
initialize
(
initializationContext
,
logConfig
,
logFile
);
system
.
initialize
(
initializationContext
,
logConfig
,
logFile
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
Throwable
exceptionToReport
=
ex
;
while
(
exceptionToReport
!=
null
&&
!(
exceptionToReport
instanceof
FileNotFoundException
))
{
exceptionToReport
=
exceptionToReport
.
getCause
();
}
exceptionToReport
=
(
exceptionToReport
!=
null
)
?
exceptionToReport
:
ex
;
// NOTE: We can't use the logger here to report the problem
// NOTE: We can't use the logger here to report the problem
System
.
err
.
println
(
"Logging system failed to initialize using configuration from '"
+
logConfig
+
"'"
);
System
.
err
.
println
(
"Logging system failed to initialize using configuration from '"
+
logConfig
+
"'"
);
ex
.
printStackTrace
(
System
.
err
);
ex
ceptionToReport
.
printStackTrace
(
System
.
err
);
throw
new
IllegalStateException
(
ex
);
throw
new
IllegalStateException
(
ex
);
}
}
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java
View file @
21897a70
...
@@ -173,9 +173,10 @@ class LoggingApplicationListenerTests {
...
@@ -173,9 +173,10 @@ class LoggingApplicationListenerTests {
addPropertiesToEnvironment
(
this
.
context
,
"logging.config=doesnotexist.xml"
);
addPropertiesToEnvironment
(
this
.
context
,
"logging.config=doesnotexist.xml"
);
assertThatIllegalStateException
().
isThrownBy
(()
->
{
assertThatIllegalStateException
().
isThrownBy
(()
->
{
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
context
.
getClassLoader
());
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
context
.
getClassLoader
());
assertThat
(
this
.
output
)
.
contains
(
"Logging system failed to initialize using configuration from 'doesnotexist.xml'"
);
});
});
assertThat
(
this
.
output
)
.
contains
(
"Logging system failed to initialize using configuration from 'doesnotexist.xml'"
)
.
doesNotContain
(
"JoranException"
);
}
}
@Test
@Test
...
...
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