logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1521714 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/ log4j-core/src/main/java/org/apache/logging/log4j/core/appe...
Date Wed, 11 Sep 2013 01:21:57 GMT
Author: ggregory
Date: Wed Sep 11 01:21:56 2013
New Revision: 1521714

URL: http://svn.apache.org/r1521714
Log:
[LOG4J2-399] Allow the default file rollover strategy to define the compression level.

Added:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/AbstractRollingAppenderSizeTest.java
      - copied, changed from r1521642, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeGzTest.java
  (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeZipTest.java
  (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-gz.xml
      - copied unchanged from r1521642, logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling1.xml
    logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-zip.xml   (with
props)
Removed:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling1.xml
Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/helper/ZipCompressAction.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginManager.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java?rev=1521714&r1=1521713&r2=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
Wed Sep 11 01:21:56 2013
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.ap
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.zip.Deflater;
 
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
@@ -163,7 +164,8 @@ public final class RollingFileAppender e
         }
 
         if (strategy == null) {
-            strategy = DefaultRolloverStrategy.createStrategy(null, null, null, config);
+            strategy = DefaultRolloverStrategy.createStrategy(null, null, null,
+                    String.valueOf(Deflater.DEFAULT_COMPRESSION), config);
         }
 
         if (layout == null) {

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java?rev=1521714&r1=1521713&r2=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
Wed Sep 11 01:21:56 2013
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.ap
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.zip.Deflater;
 
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
@@ -183,8 +184,8 @@ public final class RollingRandomAccessFi
         }
 
         if (strategy == null) {
-            strategy = DefaultRolloverStrategy.createStrategy(null, null,
-                    "true", config);
+            strategy = DefaultRolloverStrategy.createStrategy(null, null, null,
+                    String.valueOf(Deflater.DEFAULT_COMPRESSION), config);
         }
 
         if (layout == null) {

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java?rev=1521714&r1=1521713&r2=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
Wed Sep 11 01:21:56 2013
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.ap
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.zip.Deflater;
 
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.appender.rolling.helper.Action;
@@ -30,23 +31,31 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
 import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.helpers.Integers;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
 import org.apache.logging.log4j.status.StatusLogger;
 
 /**
  * When rolling over, <code>DefaultRolloverStrategy</code> renames files
  * according to an algorithm as described below.
- * <p/>
- * <p>The DefaultRolloverStrategy is a combination of a time-based policy and a fixed-window
policy. When
+ * 
+ * <p>
+ * The DefaultRolloverStrategy is a combination of a time-based policy and a fixed-window
policy. When
  * the file name pattern contains a date format then the rollover time interval will be used
to calculate the
  * time to use in the file pattern. When the file pattern contains an integer replacement
token one of the
- * counting techniques will be used.</p>
- * <p>When the ascending attribute is set to true (the default) then the counter will
be incremented and the
+ * counting techniques will be used.
+ * </p>
+ * <p>
+ * When the ascending attribute is set to true (the default) then the counter will be incremented
and the
  * current log file will be renamed to include the counter value. If the counter hits the
maximum value then
  * the oldest file, which will have the smallest counter, will be deleted, all other files
will be renamed to
  * have their counter decremented and then the current file will be renamed to have the maximum
counter value.
- * Note that with this counting strategy specifying a large maximum value may entirely avoid
renaming files.</p>
- * <p>When the ascending attribute is false, then the "normal" fixed-window strategy
will be used.</p>
+ * Note that with this counting strategy specifying a large maximum value may entirely avoid
renaming files.
+ * </p>
+ * <p>
+ * When the ascending attribute is false, then the "normal" fixed-window strategy will be
used.
+ * </p>
+ * <p>
  * Let <em>max</em> and <em>min</em> represent the values of respectively
  * the <b>MaxIndex</b> and <b>MinIndex</b> options. Let "foo.log"
be the value
  * of the <b>ActiveFile</b> option and "foo.%i.log" the value of
@@ -59,9 +68,11 @@ import org.apache.logging.log4j.status.S
  * <code>foo.<em>min+2</em>.log</code>. Lastly, the active file <code>foo.log</code>
  * will be renamed as <code>foo.<em>min</em>.log</code> and a new
active file name
  * <code>foo.log</code> will be created.
- * <p/>
- * <p>Given that this rollover algorithm requires as many file renaming
+ * </p>
+ * <p>
+ * Given that this rollover algorithm requires as many file renaming
  * operations as the window size, large window sizes are discouraged.
+ * </p>
  */
 @Plugin(name = "DefaultRolloverStrategy", category = "Core", printObject = true)
 public class DefaultRolloverStrategy implements RolloverStrategy {
@@ -86,17 +97,20 @@ public class DefaultRolloverStrategy imp
     private final boolean useMax;
 
     private final StrSubstitutor subst;
+    
+    private final int compressionLevel;
 
     /**
      * Constructs a new instance.
-     * @param min The minimum index.
-     * @param max The maximum index.
+     * @param minIndex The minimum index.
+     * @param maxIndex The maximum index.
      */
-    protected DefaultRolloverStrategy(final int min, final int max, final boolean useMax,
final StrSubstitutor subst) {
-        minIndex = min;
-        maxIndex = max;
-        this.subst = subst;
+    protected DefaultRolloverStrategy(final int minIndex, final int maxIndex, final boolean
useMax, final int compressionLevel, final StrSubstitutor subst) {
+        this.minIndex = minIndex;
+        this.maxIndex = maxIndex;
         this.useMax = useMax;
+        this.compressionLevel = compressionLevel;
+        this.subst = subst;
     }
 
     /**
@@ -127,7 +141,8 @@ public class DefaultRolloverStrategy imp
                 compressAction = new GZCompressAction(new File(renameTo), new File(compressedName),
true);
             } else if (renameTo.endsWith(".zip")) {
                 renameTo = renameTo.substring(0, renameTo.length() - 4);
-                compressAction = new ZipCompressAction(new File(renameTo), new File(compressedName),
true);
+                compressAction = new ZipCompressAction(new File(renameTo), new File(compressedName),
true, 
+                        compressionLevel);
             }
 
             final FileRenameAction renameAction =
@@ -357,6 +372,7 @@ public class DefaultRolloverStrategy imp
      * @param min The minimum number of files to keep.
      * @param fileIndex If set to "max" (the default), files with a higher index will be
newer than files with a
      * smaller index. If set to "min", file renaming and the counter will follow the Fixed
Window strategy.
+     * @param compressionLevelStr The compression level, 0 (less) through 9 (more); applies
only to ZIP files.
      * @param config The Configuration.
      * @return A DefaultRolloverStrategy.
      */
@@ -365,6 +381,7 @@ public class DefaultRolloverStrategy imp
             @PluginAttribute("max") final String max,
             @PluginAttribute("min") final String min,
             @PluginAttribute("fileIndex") final String fileIndex,
+            @PluginAttribute("compressionLevel") final String compressionLevelStr,
             @PluginConfiguration final Configuration config) {
         final boolean useMax = fileIndex == null ? true : fileIndex.equalsIgnoreCase("max");
         int minIndex;
@@ -387,7 +404,8 @@ public class DefaultRolloverStrategy imp
         } else {
             maxIndex = DEFAULT_WINDOW_SIZE;
         }
-        return new DefaultRolloverStrategy(minIndex, maxIndex, useMax, config.getStrSubstitutor());
+        final int compressionLevel = Integers.parseInt(compressionLevelStr, Deflater.DEFAULT_COMPRESSION);
+        return new DefaultRolloverStrategy(minIndex, maxIndex, useMax, compressionLevel,
config.getStrSubstitutor());
     }
 
 }

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/helper/ZipCompressAction.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/helper/ZipCompressAction.java?rev=1521714&r1=1521713&r2=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/helper/ZipCompressAction.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/helper/ZipCompressAction.java
Wed Sep 11 01:21:56 2013
@@ -45,6 +45,11 @@ public final class ZipCompressAction ext
      * If true, attempt to delete file on completion.
      */
     private final boolean deleteSource;
+    
+    /**
+     * Compression level.
+     */
+    private final int level;
 
     /**
      * Create new instance of GZCompressAction.
@@ -53,8 +58,9 @@ public final class ZipCompressAction ext
      * @param destination  compressed file, may not be null.
      * @param deleteSource if true, attempt to delete file on completion.  Failure to delete
      *                     does not cause an exception to be thrown or affect return value.
+     * @param level TODO
      */
-    public ZipCompressAction(final File source, final File destination, final boolean deleteSource)
{
+    public ZipCompressAction(final File source, final File destination, final boolean deleteSource,
int level) {
         if (source == null) {
             throw new NullPointerException("source");
         }
@@ -66,6 +72,7 @@ public final class ZipCompressAction ext
         this.source = source;
         this.destination = destination;
         this.deleteSource = deleteSource;
+        this.level = level;
     }
 
     /**
@@ -76,7 +83,7 @@ public final class ZipCompressAction ext
      */
     @Override
     public boolean execute() throws IOException {
-        return execute(source, destination, deleteSource);
+        return execute(source, destination, deleteSource, level);
     }
 
     /**
@@ -86,15 +93,17 @@ public final class ZipCompressAction ext
      * @param destination  compressed file, may not be null.
      * @param deleteSource if true, attempt to delete file on completion.  Failure to delete
      *                     does not cause an exception to be thrown or affect return value.
+     * @param level the compression level
      * @return true if source file compressed.
      * @throws IOException on IO exception.
      */
-    public static boolean execute(final File source, final File destination, final boolean
deleteSource)
+    public static boolean execute(final File source, final File destination, final boolean
deleteSource, int level)
         throws IOException {
         if (source.exists()) {
             final FileInputStream fis = new FileInputStream(source);
             final FileOutputStream fos = new FileOutputStream(destination);
             final ZipOutputStream zos = new ZipOutputStream(fos);
+            zos.setLevel(level);
 
             final ZipEntry zipEntry = new ZipEntry(source.getName());
             zos.putNextEntry(zipEntry);

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginManager.java?rev=1521714&r1=1521713&r2=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginManager.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginManager.java
Wed Sep 11 01:21:56 2013
@@ -154,7 +154,7 @@ public class PluginManager {
                 pluginTypeMap = map;
                 plugins = map.get(type);
             } else {
-                LOGGER.warn("Plugin preloads not available");
+                LOGGER.warn("Plugin preloads not available from class loader {}", classLoader);
             }
         }
         if (plugins == null || plugins.size() == 0) {

Copied: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/AbstractRollingAppenderSizeTest.java
(from r1521642, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/AbstractRollingAppenderSizeTest.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/AbstractRollingAppenderSizeTest.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java&r1=1521642&r2=1521714&rev=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/AbstractRollingAppenderSizeTest.java
Wed Sep 11 01:21:56 2013
@@ -26,23 +26,27 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
  *
  */
-public class RollingAppenderSizeTest {
+public abstract class AbstractRollingAppenderSizeTest {
+
+    protected AbstractRollingAppenderSizeTest(String fileExtension) {
+        super();
+        this.fileExtension = fileExtension;
+    }
 
-    private static final String CONFIG = "log4j-rolling1.xml";
     private static final String DIR = "target/rolling1";
+    
+    private final String fileExtension;
 
-    org.apache.logging.log4j.Logger logger = LogManager.getLogger(RollingAppenderSizeTest.class.getName());
+    org.apache.logging.log4j.Logger logger = LogManager.getLogger(AbstractRollingAppenderSizeTest.class.getName());
 
-    @BeforeClass
-    public static void setupClass() {
+    protected static void setupClass(String configPath) {
         deleteDir();
-        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
+        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, configPath);
         final LoggerContext ctx = (LoggerContext) LogManager.getContext();
         final Configuration config = ctx.getConfiguration();
     }
@@ -67,7 +71,7 @@ public class RollingAppenderSizeTest {
         assertTrue("No files created", files.length > 0);
         boolean found = false;
         for (final File file : files) {
-            if (file.getName().endsWith(".gz")) {
+            if (file.getName().endsWith(fileExtension)) {
                 found = true;
                 break;
             }

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeGzTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeGzTest.java?rev=1521714&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeGzTest.java
(added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeGzTest.java
Wed Sep 11 01:21:56 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.apache.logging.log4j.core.appender.rolling;
+
+import org.junit.BeforeClass;
+
+public class RollingAppenderSizeGzTest extends AbstractRollingAppenderSizeTest {
+
+    public RollingAppenderSizeGzTest() {
+        super(".gz");
+    }
+
+    private static final String CONFIG = "log4j-rolling-gz.xml";
+
+    @BeforeClass
+    public static void setupClass() {
+        setupClass(CONFIG);
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeGzTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeGzTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeZipTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeZipTest.java?rev=1521714&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeZipTest.java
(added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeZipTest.java
Wed Sep 11 01:21:56 2013
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.apache.logging.log4j.core.appender.rolling;
+
+import org.junit.BeforeClass;
+
+public class RollingAppenderSizeZipTest extends AbstractRollingAppenderSizeTest {
+
+    public RollingAppenderSizeZipTest() {
+        super(".zip");
+    }
+
+    private static final String CONFIG = "log4j-rolling-zip.xml";
+
+    @BeforeClass
+    public static void setupClass() {
+        setupClass(CONFIG);
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeZipTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderSizeZipTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-zip.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-zip.xml?rev=1521714&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-zip.xml (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-zip.xml Wed Sep
11 01:21:56 2013
@@ -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="warn" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+  <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.zip">
+      <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

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-zip.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j-rolling-zip.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1521714&r1=1521713&r2=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Wed Sep 11 01:21:56 2013
@@ -43,6 +43,9 @@
       <action issue="LOG4J2-391" dev="rgoers" type="fix" due-to="Kamal Bahadur">
         FlumePersistentManager now handles LockConflictExceptions in Berkeley Db.
       </action>
+      <action issue="LOG4J2-399" dev="ggregory" type="add">
+        Allow the default file rollover strategy to define the compression level.
+      </action>
       <action issue="LOG4J2-338" dev="rgoers" type="add" due-to="Tibor Benke">
         Add TLSAppender. Also added missing license headers to several files.
       </action>

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml?rev=1521714&r1=1521713&r2=1521714&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml Wed Sep 11 01:21:56 2013
@@ -2398,6 +2398,14 @@ public class JpaLogEntity extends Abstra
                   <td>The maximum value of the counter. Once this values is reached
older archives will be
                     deleted on subsequent rollovers.</td>
                 </tr>
+                <tr>
+                  <td>compressionLevel</td>
+                  <td>integer</td>
+                  <td>
+                    Sets the compression level, 0-9, where 0 = none, 1 = best speed, through
9 = best compression.
+                    Only implemented for ZIP files.
+                  </td>
+                </tr>
                 <caption align="top">DefaultRolloverStrategy Parameters</caption>
               </table>
 



Mime
View raw message