Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
Logging Log4j2
Commits
2a051c2c
Commit
2a051c2c
authored
6 years ago
by
Ralph Goers
Browse files
Options
Download
Email Patches
Plain Diff
LOG4J2-2266 - Use classloaders when loading properties
parent
af5cd992
LOG4J2-2266
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+12
-2
...in/java/org/apache/logging/log4j/util/PropertiesUtil.java
with
12 additions
and
2 deletions
+12
-2
log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+
12
-
2
View file @
2a051c2c
...
...
@@ -316,12 +316,22 @@ public final class PropertiesUtil {
private
Environment
(
final
PropertySource
propertySource
)
{
sources
.
add
(
propertySource
);
for
(
final
PropertySource
source
:
ServiceLoader
.
load
(
PropertySource
.
class
))
{
sources
.
add
(
source
);
for
(
ClassLoader
classLoader
:
LoaderUtil
.
getClassLoaders
())
{
try
{
loadPropertySource
(
classLoader
);
}
catch
(
Throwable
ex
)
{
LowLevelLogUtil
.
log
(
"Unable to retrieve propertySource from ClassLoader "
+
classLoader
+
", "
+
ex
.
getMessage
());
}
}
reload
();
}
private
void
loadPropertySource
(
ClassLoader
classLoader
)
{
for
(
final
PropertySource
source
:
ServiceLoader
.
load
(
PropertySource
.
class
,
classLoader
))
{
sources
.
add
(
source
);
}
}
private
synchronized
void
reload
()
{
literal
.
clear
();
normalized
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help