You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2018/07/15 14:17:01 UTC

logging-log4j2 git commit: The config object can be null when this builder is built programmatically.

Repository: logging-log4j2
Updated Branches:
  refs/heads/release-2.x fe4a95bd6 -> 50a63a0cf


The config object can be null when this builder is built
programmatically.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/50a63a0c
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/50a63a0c
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/50a63a0c

Branch: refs/heads/release-2.x
Commit: 50a63a0cf327bd7671282436eb23289738bab171
Parents: fe4a95b
Author: Gary Gregory <ga...@gmail.com>
Authored: Sun Jul 15 08:16:58 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Sun Jul 15 08:16:58 2018 -0600

----------------------------------------------------------------------
 .../log4j/core/appender/rolling/DefaultRolloverStrategy.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/50a63a0c/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index dfacd72..3c733d4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -142,7 +142,9 @@ public class DefaultRolloverStrategy extends AbstractRolloverStrategy {
                 }
             }
             final int compressionLevel = Integers.parseInt(compressionLevelStr, Deflater.DEFAULT_COMPRESSION);
-            return new DefaultRolloverStrategy(minIndex, maxIndex, useMax, compressionLevel, config.getStrSubstitutor(),
+            // The config object can be null when this object is built programmatically.
+            StrSubstitutor nonNullStrSubstitutor = config != null ? config.getStrSubstitutor() : new StrSubstitutor();
+			return new DefaultRolloverStrategy(minIndex, maxIndex, useMax, compressionLevel, nonNullStrSubstitutor,
                     customActions, stopCustomActionsOnError, tempCompressedFilePattern);
         }