You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2022/02/16 17:07:30 UTC

[GitHub] [logging-log4j2] ppkarwasz commented on a change in pull request #756: [LOG4J2-3404] Creates default layouts using the available Configuration

ppkarwasz commented on a change in pull request #756:
URL: https://github.com/apache/logging-log4j2/pull/756#discussion_r808247913



##########
File path: log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
##########
@@ -763,10 +762,7 @@ public Builder withFooter(final String footer) {
 
         @Override
         public PatternLayout build() {
-            // fall back to DefaultConfiguration
-            if (configuration == null) {
-                configuration = new DefaultConfiguration();
-            }
+            // should work with a null configuration

Review comment:
       This requires more explanations: the `PatternParser` does not use a configuration directly (or has null checks), but allows one to be injected into the `PatternConverter`s.
   
   Looking at the available `PatternConverter`s, the color converters, "enc", "equals*", "highlight", "maxLength", "replace", "style", "ex*" require a configuration to create a `PatternParser`.
   
   I didn't find any converters except `LiteralPatternConverter` that actually use `Configuration`. `LiteralPatternConverter` has appropriate null checks.




-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org