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 2016/04/19 00:19:35 UTC

logging-log4j2 git commit: [LOG4J2-1369] "xz" compression results in plaintext, uncompressed files.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 792153507 -> 49a13f14d


[LOG4J2-1369] "xz" compression results in plaintext, uncompressed 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/49a13f14
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/49a13f14
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/49a13f14

Branch: refs/heads/master
Commit: 49a13f14d9b3f933da306a76a6c333860da80c3f
Parents: 7921535
Author: ggregory <gg...@apache.org>
Authored: Mon Apr 18 15:19:32 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Mon Apr 18 15:19:32 2016 -0700

----------------------------------------------------------------------
 .../rolling/DefaultRolloverStrategy.java        | 16 +++++-
 .../rolling/RollingAppenderSizeTest.java        |  2 +-
 .../src/test/resources/log4j-rolling-xy.xml     | 59 --------------------
 .../src/test/resources/log4j-rolling-xz.xml     | 59 ++++++++++++++++++++
 src/changes/changes.xml                         |  3 +
 5 files changed, 77 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/49a13f14/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 e3b8ffe..df613bc 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
@@ -122,12 +122,24 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
                 return new CommonsCompressAction("pack200", source(renameTo), target(compressedName), deleteSource);
             }
         },
-        XY(".xy") {
+        /**
+         * @deprecated Use {@link #XZ}.
+         */
+        @Deprecated
+        XY(".xz") {
             @Override
             Action createCompressAction(final String renameTo, final String compressedName, final boolean deleteSource,
                     final int compressionLevel) {
                 // One of "gz", "bzip2", "xz", "pack200", or "deflate".
-                return new CommonsCompressAction("xy", source(renameTo), target(compressedName), deleteSource);
+                return new CommonsCompressAction("xz", source(renameTo), target(compressedName), deleteSource);
+            }
+        },
+        XZ(".xz") {
+            @Override
+            Action createCompressAction(final String renameTo, final String compressedName, final boolean deleteSource,
+                    final int compressionLevel) {
+                // One of "gz", "bzip2", "xz", "pack200", or "deflate".
+                return new CommonsCompressAction("xz", source(renameTo), target(compressedName), deleteSource);
             }
         };
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/49a13f14/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
index fce9fb4..0ae14b3 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
@@ -64,7 +64,7 @@ public class RollingAppenderSizeTest {
                 {"log4j-rolling-bzip2.xml", ".bz2"}, //
                 {"log4j-rolling-deflate.xml", ".deflate"}, //
                 {"log4j-rolling-pack200.xml", ".pack200"}, //
-                {"log4j-rolling-xy.xml", ".xy"},});
+                {"log4j-rolling-xz.xml", ".xz"},});
                 // @formatter:on
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/49a13f14/log4j-core/src/test/resources/log4j-rolling-xy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-xy.xml b/log4j-core/src/test/resources/log4j-rolling-xy.xml
deleted file mode 100644
index e82a7d5..0000000
--- a/log4j-core/src/test/resources/log4j-rolling-xy.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<Configuration status="OFF" name="XMLConfigTest">
-  <Properties>
-    <Property name="filename">target/rolling1/rollingtest.log</Property>
-  </Properties>
-  <ThresholdFilter level="debug"/>
-
-  <Appenders>
-    <Console name="STDOUT">
-      <PatternLayout pattern="%m%n"/>
-    </Console>
-    <RollingFile name="RollingFile" fileName="${filename}"
-                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.xy">
-      <PatternLayout>
-        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
-      </PatternLayout>
-      <SizeBasedTriggeringPolicy size="500" />
-      <DefaultRolloverStrategy compressionLevel="9" />
-    </RollingFile>
-    <List name="List">
-      <ThresholdFilter level="error"/>
-    </List>
-  </Appenders>
-
-  <Loggers>
-    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
-      <ThreadContextMapFilter>
-        <KeyValuePair key="test" value="123"/>
-      </ThreadContextMapFilter>
-      <AppenderRef ref="STDOUT"/>
-    </Logger>>
-
-    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
-      <AppenderRef ref="RollingFile"/>
-    </Logger>>
-
-    <Root level="error">
-      <AppenderRef ref="STDOUT"/>
-    </Root>
-  </Loggers>
-
-</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/49a13f14/log4j-core/src/test/resources/log4j-rolling-xz.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-rolling-xz.xml b/log4j-core/src/test/resources/log4j-rolling-xz.xml
new file mode 100644
index 0000000..5b588c3
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-rolling-xz.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<Configuration status="OFF" name="XMLConfigTest">
+  <Properties>
+    <Property name="filename">target/rolling1/rollingtest.log</Property>
+  </Properties>
+  <ThresholdFilter level="debug"/>
+
+  <Appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <RollingFile name="RollingFile" fileName="${filename}"
+                 filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.xz">
+      <PatternLayout>
+        <Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
+      </PatternLayout>
+      <SizeBasedTriggeringPolicy size="500" />
+      <DefaultRolloverStrategy compressionLevel="9" />
+    </RollingFile>
+    <List name="List">
+      <ThresholdFilter level="error"/>
+    </List>
+  </Appenders>
+
+  <Loggers>
+    <Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <ThreadContextMapFilter>
+        <KeyValuePair key="test" value="123"/>
+      </ThreadContextMapFilter>
+      <AppenderRef ref="STDOUT"/>
+    </Logger>>
+
+    <Logger name="org.apache.logging.log4j.core.appender.rolling" level="debug" additivity="false">
+      <AppenderRef ref="RollingFile"/>
+    </Logger>>
+
+    <Root level="error">
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
+
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/49a13f14/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3f58732..671d3c5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.6" date="2016-MM-DD" description="GA Release 2.6">
+      <action issue="LOG4J2-1369" dev="ggregory" type="fix" due-to="Alex Birch, Gary Gregory">
+        "xz" compression results in plaintext, uncompressed files.
+      </action>
       <action issue="LOG4J2-1365" dev="mikes" type="update">
         (Log4j-internal) Provide message text as CharSequence for some message types to optimize some layouts.
       </action>