ppkarwasz commented on a change in pull request #761:
URL: https://github.com/apache/logging-log4j2/pull/761#discussion_r810286544
##########
File path:
log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfiguration.java
##########
@@ -436,6 +436,10 @@ public Appender parseAppender(final Properties props,
final String appenderName)
final String layoutPrefix = prefix + ".layout";
final String filterPrefix = APPENDER_PREFIX + appenderName +
".filter.";
final String className = OptionConverter.findAndSubst(prefix, props);
+ if (className == null) {
+ LOGGER.debug("Appender \"" + appenderName + "\" does not exist.");
+ return null;
+ }
Review comment:
Remark also that Log4j 1.x behaves differently
- whenever **any** component has an empty property the error "Could not find
value for key ..." is logged (cf. [source
code](https://github.com/apache/logging-log4j1/blob/v1_2_17/src/main/java/org/apache/log4j/helpers/OptionConverter.java#L120).
- then there is a message "Could not instantiate appender named ..." (cf.
[source
code](https://github.com/apache/logging-log4j1/blob/de9f0ea504db9d1178db2cf45323d8e182a5df0a/src/main/java/org/apache/log4j/PropertyConfigurator.java#L790)).
This should probably be checked just before the return statement. Remark that
appender instantiation can also fail if some other properties are missing (e.g.
`File` for the file appender).
--
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]