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
1e7ed2ff
Commit
1e7ed2ff
authored
Jun 18, 2018
by
Johnny Lim
Committed by
Stephane Nicoll
Jun 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add log level guards in ConfigFileApplicationListener
Closes gh-13512
parent
87680b4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
ConfigFileApplicationListener.java
...rk/boot/context/config/ConfigFileApplicationListener.java
+27
-10
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
View file @
1e7ed2ff
...
...
@@ -386,8 +386,10 @@ public class ConfigFileApplicationListener
return
;
}
if
(
this
.
activatedProfiles
)
{
this
.
logger
.
debug
(
"Profiles already activated, '"
+
profiles
+
"' will not be applied"
);
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Profiles already activated, '"
+
profiles
+
"' will not be applied"
);
}
return
;
}
this
.
profiles
.
addAll
(
profiles
);
...
...
@@ -501,23 +503,28 @@ public class ConfigFileApplicationListener
DocumentFilter
filter
,
DocumentConsumer
consumer
)
{
try
{
Resource
resource
=
this
.
resourceLoader
.
getResource
(
location
);
String
description
=
getDescription
(
location
,
resource
);
if
(
profile
!=
null
)
{
description
=
description
+
" for profile "
+
profile
;
}
if
(
resource
==
null
||
!
resource
.
exists
())
{
this
.
logger
.
trace
(
"Skipped missing config "
+
description
);
if
(
this
.
logger
.
isTraceEnabled
())
{
this
.
logger
.
trace
(
"Skipped missing config "
+
getDescription
(
location
,
resource
,
profile
));
}
return
;
}
if
(!
StringUtils
.
hasText
(
StringUtils
.
getFilenameExtension
(
resource
.
getFilename
())))
{
this
.
logger
.
trace
(
"Skipped empty config extension "
+
description
);
if
(
this
.
logger
.
isTraceEnabled
())
{
this
.
logger
.
trace
(
"Skipped empty config extension "
+
getDescription
(
location
,
resource
,
profile
));
}
return
;
}
String
name
=
"applicationConfig: ["
+
location
+
"]"
;
List
<
Document
>
documents
=
loadDocuments
(
loader
,
name
,
resource
);
if
(
CollectionUtils
.
isEmpty
(
documents
))
{
this
.
logger
.
trace
(
"Skipped unloaded config "
+
description
);
if
(
this
.
logger
.
isTraceEnabled
())
{
this
.
logger
.
trace
(
"Skipped unloaded config "
+
getDescription
(
location
,
resource
,
profile
));
}
return
;
}
List
<
Document
>
loaded
=
new
ArrayList
<>();
...
...
@@ -531,7 +538,10 @@ public class ConfigFileApplicationListener
Collections
.
reverse
(
loaded
);
if
(!
loaded
.
isEmpty
())
{
loaded
.
forEach
((
document
)
->
consumer
.
accept
(
profile
,
document
));
this
.
logger
.
debug
(
"Loaded config file "
+
description
);
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Loaded config file "
+
getDescription
(
location
,
resource
,
profile
));
}
}
}
catch
(
Exception
ex
)
{
...
...
@@ -576,6 +586,13 @@ public class ConfigFileApplicationListener
}).
collect
(
Collectors
.
toList
());
}
private
String
getDescription
(
String
location
,
Resource
resource
,
Profile
profile
)
{
String
description
=
getDescription
(
location
,
resource
);
return
(
profile
!=
null
?
description
+
" for profile "
+
profile
:
description
);
}
private
String
getDescription
(
String
location
,
Resource
resource
)
{
try
{
if
(
resource
!=
null
)
{
...
...
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