jeremylong commented on code in PR #120:
URL: https://github.com/apache/commons-jcs/pull/120#discussion_r1038873372
##########
commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/LogManager.java:
##########
@@ -57,15 +61,34 @@ private static LogFactory createLogFactory()
LogManager.logSystem = System.getProperty("jcs.logSystem",
LOGSYSTEM_JAVA_UTIL_LOGGING);
}
-
- for (final LogFactory factory : factories)
- {
- if (logSystem.equalsIgnoreCase(factory.getName()))
- {
- return factory;
+ List<ServiceConfigurationError> errors = new ArrayList<>();
+ Iterator<LogFactory> itr = factories.iterator();
+ LogFactory factory = null;
+ while (itr.hasNext()) {
+ try {
+ LogFactory instance = itr.next();
+ if (logSystem.equalsIgnoreCase(instance.getName())) {
+ factory = instance;
+ break;
+ }
+ } catch (ServiceConfigurationError e) {
+ errors.add(e);
}
}
-
+ if (factory != null) {
+ if (!errors.isEmpty()) {
+ Log log = factory.getLog(LogFactoryHolder.class);
+ for (ServiceConfigurationError error : errors) {
+ log.debug("Error loading LogFactory", error);
+ }
+ log.debug("Found LogFacgtory for " + logSystem);
Review Comment:
```suggestion
log.debug("Found LogFactory for " + logSystem);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]