Repository: logging-log4j2
Updated Branches:
  refs/heads/master 56d76f13f -> 16620e8dd


[LOG4J2-2016] Mark FileRenameAction as successful when using alternative
ways to move files.

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

Branch: refs/heads/master
Commit: 16620e8ddee812f06483b643b5f7b2913ff09e0e
Parents: 56d76f1
Author: Benjamin Jaton <[email protected]>
Authored: Tue Aug 15 18:06:14 2017 -0600
Committer: Gary Gregory <[email protected]>
Committed: Tue Aug 15 18:06:14 2017 -0600

----------------------------------------------------------------------
 .../log4j/core/appender/rolling/action/FileRenameAction.java      | 3 ++-
 src/changes/changes.xml                                           | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/16620e8d/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java
index da3f3d2..2538306 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/FileRenameAction.java
@@ -124,13 +124,14 @@ public class FileRenameAction extends AbstractAction {
                 } catch (final IOException exMove) {
                     LOGGER.error("Unable to move file {} to {}: {} {}", 
source.getAbsolutePath(),
                             destination.getAbsolutePath(), 
exMove.getClass().getName(), exMove.getMessage());
-                    final boolean result = source.renameTo(destination);
+                    boolean result = source.renameTo(destination);
                     if (!result) {
                         try {
                             Files.copy(Paths.get(source.getAbsolutePath()), 
Paths.get(destination.getAbsolutePath()),
                                     StandardCopyOption.REPLACE_EXISTING);
                             try {
                                 
Files.delete(Paths.get(source.getAbsolutePath()));
+                                result = true;
                                 LOGGER.trace("Renamed file {} to {} using copy 
and delete",
                                         source.getAbsolutePath(), 
destination.getAbsolutePath());
                             } catch (final IOException exDelete) {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/16620e8d/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b753dc7..764c94e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -55,6 +55,9 @@
       <action issue="LOG4J2-1864" dev="mattsicker" type="add" due-to="Matthias 
Kappeller">
         Support capped collections for MongoDb appender.
       </action>
+      <action issue="LOG4J2-2016" dev="ggregory" type="fix" due-to="Benjamin 
Jaton">
+        Mark FileRenameAction as successful when using alternative ways to 
move files.
+      </action>
       <action issue="LOG4J2-1888" dev="ggregory" type="fix" due-to="Misagh 
Moayyed">
         Log4j throws a java.nio.charset.UnsupportedCharsetException: cp65001.
       </action>

Reply via email to