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 2017/02/16 21:26:40 UTC

logging-log4j2 git commit: [LOG4J2-1818]

Repository: logging-log4j2
Updated Branches:
  refs/heads/master ae3320b65 -> 62e348b3e


[LOG4J2-1818] 

Fix rollover to work when filePattern contains no directory components.

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

Branch: refs/heads/master
Commit: 62e348b3e44c6328b7b04d69ec7fc5d82950fa34
Parents: ae3320b
Author: ggregory <gg...@US-L-GG05.rocketsoftware.com>
Authored: Thu Feb 16 13:26:37 2017 -0800
Committer: ggregory <gg...@US-L-GG05.rocketsoftware.com>
Committed: Thu Feb 16 13:26:37 2017 -0800

----------------------------------------------------------------------
 .../log4j/core/appender/rolling/AbstractRolloverStrategy.java  | 6 +++++-
 src/changes/changes.xml                                        | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/62e348b3/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/AbstractRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/AbstractRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/AbstractRolloverStrategy.java
index 7981c7c..0ac033e 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/AbstractRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/AbstractRolloverStrategy.java
@@ -104,7 +104,11 @@ public abstract class AbstractRolloverStrategy implements RolloverStrategy {
         TreeMap<Integer, Path> eligibleFiles = new TreeMap<>();
         File file = new File(path);
         File parent = file.getParentFile();
-        parent.mkdirs();
+        if (parent == null) {
+            parent = new File(".");
+        } else {
+            parent.mkdirs();
+        }
         if (!path.contains("--1")) {
             return eligibleFiles;
         }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/62e348b3/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 61b80dd..b37bc1c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -55,6 +55,9 @@
       <action issue="LOG4J2-1806" dev="rpopma" type="fix" due-to="challarao">
         Fix javadoc for DefaultRolloverStrategy::purgeAscending
       </action>
+      <action issue="LOG4J2-1818" dev="ggregory" type="fix" due-to="xkr47">
+        Fix rollover to work when filePattern contains no directory components.
+      </action>
     </release>
     <release version="2.8" date="2017-01-21" description="GA Release 2.8">
       <action issue="LOG4J2-1780" dev="mikes" type="fix">