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 2019/06/23 02:53:42 UTC

[logging-log4j2] branch release-2.x updated (93ba10b -> 71fd036)

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 93ba10b  Remove trailing whitespace.
     new 6e20437  Update Spring versions
     new 71fd036  LOG4J2-2633 - Handle NoSuchElementException

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:
 .../org/apache/logging/log4j/util/StackLocatorUtil.java    | 14 +++++++++++++-
 .../src/main/config-repo/log4j2.xml                        |  2 +-
 log4j-spring-cloud-config/pom.xml                          |  6 +++---
 3 files changed, 17 insertions(+), 5 deletions(-)


[logging-log4j2] 01/02: Update Spring versions

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 6e20437aace8aa180975805ab7b9f06313df4115
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sat Jun 22 16:22:51 2019 -0700

    Update Spring versions
---
 .../src/main/config-repo/log4j2.xml                                 | 2 +-
 log4j-spring-cloud-config/pom.xml                                   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/log4j-spring-cloud-config/log4j-spring-cloud-config-samples/log4j-spring-cloud-config-sample-server/src/main/config-repo/log4j2.xml b/log4j-spring-cloud-config/log4j-spring-cloud-config-samples/log4j-spring-cloud-config-sample-server/src/main/config-repo/log4j2.xml
index 84b9673..9292a93 100644
--- a/log4j-spring-cloud-config/log4j-spring-cloud-config-samples/log4j-spring-cloud-config-sample-server/src/main/config-repo/log4j2.xml
+++ b/log4j-spring-cloud-config/log4j-spring-cloud-config-samples/log4j-spring-cloud-config-sample-server/src/main/config-repo/log4j2.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<Configuration status="DEBUG" monitorInterval="0">
+<Configuration status="ERROR" monitorInterval="0">
   <Appenders>
     <Console name="console" target="SYSTEM_OUT">
       <JsonLayout properties="true" compact="true" eventEol="true" stackTraceAsString="true">
diff --git a/log4j-spring-cloud-config/pom.xml b/log4j-spring-cloud-config/pom.xml
index 56e0d40..cfa5c9c 100644
--- a/log4j-spring-cloud-config/pom.xml
+++ b/log4j-spring-cloud-config/pom.xml
@@ -31,9 +31,9 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <revapi.skip>true</revapi.skip>
-    <spring-cloud-version>Finchley.SR3</spring-cloud-version>
-    <spring-boot.version>2.0.8.RELEASE</spring-boot.version>
-    <springVersion>5.0.12.RELEASE</springVersion>
+    <spring-cloud-version>Greenwich.SR1</spring-cloud-version>
+    <spring-boot.version>2.1.6.RELEASE</spring-boot.version>
+    <springVersion>5.1.8.RELEASE</springVersion>
     <log4jParentDir>${basedir}/..</log4jParentDir>
   </properties>
   <dependencyManagement>


[logging-log4j2] 02/02: LOG4J2-2633 - Handle NoSuchElementException

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 71fd036e0bbc40598b72676854b2827565b44836
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sat Jun 22 19:53:32 2019 -0700

    LOG4J2-2633 - Handle NoSuchElementException
---
 .../org/apache/logging/log4j/util/StackLocatorUtil.java    | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocatorUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocatorUtil.java
index 56812fe..84cc689 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocatorUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/StackLocatorUtil.java
@@ -16,13 +16,17 @@
  */
 package org.apache.logging.log4j.util;
 
+import java.util.NoSuchElementException;
 import java.util.Stack;
 
+import org.apache.logging.log4j.status.StatusLogger;
+
 /**
  * <em>Consider this class private.</em> Provides various methods to determine the caller class. <h3>Background</h3>
  */
 public final class StackLocatorUtil {
     private static StackLocator stackLocator = null;
+    private static volatile boolean errorLogged = false;
 
     static {
         stackLocator = StackLocator.getInstance();
@@ -68,6 +72,14 @@ public final class StackLocatorUtil {
     }
 
     public static StackTraceElement calcLocation(final String fqcnOfLogger) {
-        return stackLocator.calcLocation(fqcnOfLogger);
+        try {
+            return stackLocator.calcLocation(fqcnOfLogger);
+        } catch (NoSuchElementException ex) {
+            if (!errorLogged) {
+                errorLogged = true;
+                StatusLogger.getLogger().warn("Unable to locate stack trace element for {}", fqcnOfLogger, ex);
+            }
+            return null;
+        }
     }
 }