Skip to content

Commit 43a3526

Browse files
committed
Modify how the base log4j config is processed
1 parent 966d522 commit 43a3526

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

api/src/org/labkey/api/util/logging/LabKeyLog4j2ConfigurationFactory.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.io.IOException;
1717
import java.io.File;
1818
import java.util.ArrayList;
19+
import java.util.Arrays;
1920
import java.util.Comparator;
2021
import java.util.List;
2122

@@ -42,14 +43,14 @@ public Configuration getConfiguration(final LoggerContext context, final Configu
4243
try
4344
{
4445
//Get Base Log4j2 configuration
45-
List<XmlConfiguration> configs = resolveConfigFiles("classpath:log4j2.xml", context, resolver);
46+
List<XmlConfiguration> configs = Arrays.asList((XmlConfiguration) super.getConfiguration(context, source));
4647

4748
//Get any Override configurations
4849
List<XmlConfiguration> overrideConfigs = resolveConfigFiles("classpath*:**/config/*.log4j2.xml", context, resolver);
4950

5051
// If there are no override configs, then return base configuration
5152
if (overrideConfigs.isEmpty())
52-
return super.getConfiguration(context, source);
53+
return configs.get(0);
5354

5455
// Sort the override configs: 00.log4j2.xml < 01.log4j2.xml < 02.log4j2.xml
5556
overrideConfigs.sort(Comparator.comparing(AbstractConfiguration::getName));
@@ -60,7 +61,8 @@ public Configuration getConfiguration(final LoggerContext context, final Configu
6061
}
6162
catch (IOException e)
6263
{
63-
throw new RuntimeException(e);
64+
LOGGER.error("Unable to load configuration", e);
65+
return null;
6466
}
6567
}
6668

0 commit comments

Comments
 (0)