You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2015/10/11 23:06:17 UTC
[07/27] logging-log4j2 git commit: LOG4J2-1140 Fixed bug where
headers were not being written to first file with RollingFileAppender.
LOG4J2-1140 Fixed bug where headers were not being written to first file
with RollingFileAppender.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e8ccf2b1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e8ccf2b1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e8ccf2b1
Branch: refs/heads/LOG4J2-1136
Commit: e8ccf2b12732fff9c1dabd5b6ecc66ae8d7b6506
Parents: dbc5d43
Author: rpopma <rp...@apache.org>
Authored: Mon Oct 5 00:10:54 2015 +0200
Committer: Ralph Goers <rg...@nextiva.com>
Committed: Sun Oct 11 12:40:42 2015 -0700
----------------------------------------------------------------------
.../logging/log4j/core/appender/rolling/RollingFileManager.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/e8ccf2b1/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
index 72ee965..f53278f 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java
@@ -303,6 +303,8 @@ public class RollingFileManager extends FileManager {
if (null != parent && !parent.exists()) {
parent.mkdirs();
}
+ // LOG4J2-1140: check writeHeader before creating the file
+ final boolean writeHeader = !data.append || !file.exists();
try {
file.createNewFile();
} catch (final IOException ioe) {
@@ -311,7 +313,6 @@ public class RollingFileManager extends FileManager {
}
final long size = data.append ? file.length() : 0;
- final boolean writeHeader = !data.append || !file.exists();
OutputStream os;
try {
os = new FileOutputStream(name, data.append);
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8ccf2b1/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7d18eaf..c3004b6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -39,6 +39,9 @@
<action issue="LOG4J2-1020" dev="mikes" type="add">
Add possibility to set shutdown timeout on AsyncAppender.
</action>
+ <action issue="LOG4J2-1140" dev="rpopma" type="fix">
+ Fixed bug where headers were not being written to first file with RollingFileAppender.
+ </action>
<action issue="LOG4J2-1149" dev="rpopma" type="fix">
Fixed bug where PatternLayout predefined date pattern with time zone always renders default date format.
</action>