ramanathan1504 commented on code in PR #4410:
URL: https://github.com/apache/logging-log4j2/pull/4410#discussion_r4322634871
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/yaml/YamlConfigurationFactory.java:
##########
@@ -42,17 +54,33 @@ public class YamlConfigurationFactory extends
ConfigurationFactory {
private final boolean isActive;
+ private final boolean useJackson3;
+
public YamlConfigurationFactory() {
- for (final String dependency : dependencies) {
- if (!Loader.isClassAvailable(dependency)) {
- LOGGER.debug(
- "Missing dependencies for Yaml support,
ConfigurationFactory {} is inactive",
- getClass().getName());
- isActive = false;
- return;
+ if (areClassesAvailable(JACKSON3_DEPENDENCIES)) {
+ LOGGER.debug("Using Jackson 3.x for Yaml support");
+ useJackson3 = true;
+ isActive = true;
+ } else if (areClassesAvailable(JACKSON2_DEPENDENCIES)) {
+ LOGGER.debug("Using Jackson 2.x for Yaml support");
+ useJackson3 = false;
+ isActive = true;
Review Comment:
Jackson 3 parses YAML as 1.2, so `on`, `yes`, `~` and `0x10` come through as
plain strings. Apps that have both Jackson versions today get Jackson 2.
Checking Jackson 2 first keeps those apps unchanged, and Jackson-3-only apps
still get YAML support.
```suggestion
if (areClassesAvailable(JACKSON2_DEPENDENCIES)) {
LOGGER.debug("Using Jackson 2.x for Yaml support");
useJackson3 = false;
isActive = true;
} else if (areClassesAvailable(JACKSON3_DEPENDENCIES)) {
LOGGER.debug("Using Jackson 3.x for Yaml support");
useJackson3 = true;
isActive = true;
```
--
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]