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 2020/04/12 07:32:34 UTC

[logging-log4j2] branch release-2.x updated (8ebd59c -> 62863cb)

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a change to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git.


    from 8ebd59c  Merge branch 'wlfshmn-LOG4J2-2794' into release-2.x
     new 18f6f63  Fix erroneous usage of default locale
     new 62863cb  LOG4J2-2817 -  Allow the file size action to parse the value without being sensitive to the current locale.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../log4j/core/appender/rolling/FileSize.java      |  2 +-
 .../core/appender/rolling/action/FileSizeTest.java | 31 ++++++++++++++++++++++
 src/changes/changes.xml                            |  3 +++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/FileSizeTest.java


[logging-log4j2] 02/02: LOG4J2-2817 - Allow the file size action to parse the value without being sensitive to the current locale.

Posted by rg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 62863cbd0e57bacde86fca68e91853927cdeff5f
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sun Apr 12 00:32:16 2020 -0700

    LOG4J2-2817 -  Allow the file size action to parse the value without being sensitive to the current locale.
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 39ab048..6a85f57 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -30,6 +30,9 @@
          - "remove" - Removed
     -->
     <release version="2.13.2" date="2020-MM-DD" description="GA Release 2.13.2">
+      <action issue="LOG4J2-2817" dev="rgoers" type="fix" due-to="Trejkaz">
+        Allow the file size action to parse the value without being sensitive to the current locale.
+      </action>
       <action issue="LOG4J2-2794" dev="rgoers" type="fix" due-to="Johan Karlberg">
         Make YamlLayoutTest more resiliant to environmental differences.
       </action>


[logging-log4j2] 01/02: Fix erroneous usage of default locale

Posted by rg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 18f6f6356cb8f361ee82b7c5893ad819796450e2
Author: Trejkaz (pen name) <tr...@trypticon.org>
AuthorDate: Sun Mar 15 22:59:18 2020 +1100

    Fix erroneous usage of default locale
---
 .../log4j/core/appender/rolling/FileSize.java      |  2 +-
 .../core/appender/rolling/action/FileSizeTest.java | 31 ++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
index bd5dce8..f95dc8e 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileSize.java
@@ -61,7 +61,7 @@ public final class FileSize {
         if (matcher.matches()) {
             try {
                 // Get double precision value
-                final long value = NumberFormat.getNumberInstance(Locale.getDefault()).parse(
+                final long value = NumberFormat.getNumberInstance(Locale.ROOT).parse(
                     matcher.group(1)).longValue();
 
                 // Get units specified
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/FileSizeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/FileSizeTest.java
new file mode 100644
index 0000000..7b0ef87
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/FileSizeTest.java
@@ -0,0 +1,31 @@
+package org.apache.logging.log4j.core.appender.rolling.action;
+
+import org.apache.logging.log4j.core.appender.rolling.FileSize;
+import org.junit.Test;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+public class FileSizeTest {
+
+    @Test
+    public void testParse() {
+        assertThat(FileSize.parse("5k", 0), is(5L * 1024));
+    }
+
+    @Test
+    public void testParseInEurope() {
+        // Caveat: Breaks the ability for this test to run in parallel with other tests :(
+        Locale previousDefault = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("de", "DE"));
+            assertThat(FileSize.parse("1,000", 0), is(1000L));
+        } finally {
+            Locale.setDefault(previousDefault);
+        }
+    }
+}