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 2020/11/26 14:07:03 UTC

[logging-log4j2] branch release-2.x updated (a62902d -> cc65704)

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

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


    from a62902d  Fix doc: Specify log4j2.configurationFile (log4j.configurationFile does nothing)
     new 6a4692d  Simplify if/else.
     new 8eb211b  return not needed.
     new 8444354  Don't need new String object.
     new 4f9c6cf  If not needed.
     new cc65704  Merge branch 'release-2.x' of https://gitbox.apache.org/repos/asf/logging-log4j2.git into release-2.x

The 5 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:
 .../src/test/java/org/apache/log4j/VelocityTest.java         |  2 +-
 .../java/org/apache/logging/log4j/status/StatusLogger.java   | 12 ++++--------
 .../logging/log4j/core/config/ConfigurationSource.java       |  6 +-----
 .../org/apache/logging/log4j/core/lookup/Log4jLookup.java    |  1 -
 .../org/apache/logging/log4j/lookup/MapMessageLookup.java    |  1 -
 5 files changed, 6 insertions(+), 16 deletions(-)


[logging-log4j2] 05/05: Merge branch 'release-2.x' of https://gitbox.apache.org/repos/asf/logging-log4j2.git into release-2.x

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

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

commit cc657047317a0fdab327d661568d177655482e9f
Merge: 4f9c6cf a62902d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 26 09:06:34 2020 -0500

    Merge branch 'release-2.x' of https://gitbox.apache.org/repos/asf/logging-log4j2.git into release-2.x

 .../layout/template/json/resolver/MapResolver.java |  74 ++---
 .../template/json/resolver/MapResolverFactory.java |   2 +-
 ...esolver.java => ReadOnlyStringMapResolver.java} | 121 +++++---
 .../json/resolver/ThreadContextDataResolver.java   | 325 +--------------------
 .../template/json/JsonTemplateLayoutTest.java      | 179 ++++++++++--
 src/changes/changes.xml                            |   3 +
 .../asciidoc/manual/json-template-layout.adoc.vm   | 260 ++++++++---------
 src/site/xdoc/manual/configuration.xml.vm          |   2 +-
 8 files changed, 376 insertions(+), 590 deletions(-)


[logging-log4j2] 03/05: Don't need new String object.

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

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

commit 84443542b48b43c640e55266b7524b4f662ef98d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 22 14:29:22 2020 -0500

    Don't need new String object.
---
 log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java b/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java
index c1165d7..ee6596f 100644
--- a/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/VelocityTest.java
@@ -50,7 +50,7 @@ private static LoggerContext context;
     public void testVelocity() {
         Velocity.init();
         final VelocityContext vContext = new VelocityContext();
-        vContext.put("name", new String("Velocity"));
+        vContext.put("name", "Velocity");
 
         final Template template = Velocity.getTemplate("target/test-classes/hello.vm");
 


[logging-log4j2] 02/05: return not needed.

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

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

commit 8eb211beb71069a179adbffa0be315809f0c1b79
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 22 14:27:22 2020 -0500

    return not needed.
---
 .../src/main/java/org/apache/logging/log4j/core/lookup/Log4jLookup.java  | 1 -
 .../src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Log4jLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Log4jLookup.java
index 2f1ef67..7e01a52 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Log4jLookup.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Log4jLookup.java
@@ -86,7 +86,6 @@ public class Log4jLookup extends AbstractConfigurationAwareLookup {
                     }
                 } catch (final URISyntaxException use) {
                     LOGGER.error(use);
-                    return null;
                 }
             }
         }
diff --git a/log4j-samples/log4j-samples-loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java b/log4j-samples/log4j-samples-loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
index 35e6ef3..7cd7885 100644
--- a/log4j-samples/log4j-samples-loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
+++ b/log4j-samples/log4j-samples-loggerProperties/src/main/java/org/apache/logging/log4j/lookup/MapMessageLookup.java
@@ -61,7 +61,6 @@ public class MapMessageLookup extends AbstractLookup {
                 return mapMessage.get(key);
             } catch (final Exception ex) {
                 LOGGER.warn(LOOKUP, "Error while getting property [{}].", key, ex);
-                return null;
             }
         }
         return null;


[logging-log4j2] 01/05: Simplify if/else.

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

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

commit 6a4692d84194ba99c8d920d664b8f01eae54b878
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 22 14:26:00 2020 -0500

    Simplify if/else.
---
 .../java/org/apache/logging/log4j/status/StatusLogger.java   | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
index 3de75f6..319f97c 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/status/StatusLogger.java
@@ -269,17 +269,13 @@ public final class StatusLogger extends AbstractLogger {
             msgLock.unlock();
         }
         // LOG4J2-1813 if system property "log4j2.debug" is defined, all status logging is enabled
-        if (isDebugPropertyEnabled()) {
+        if (isDebugPropertyEnabled() || (listeners.size() <= 0)) {
             logger.logMessage(fqcn, level, marker, msg, t);
         } else {
-            if (listeners.size() > 0) {
-                for (final StatusListener listener : listeners) {
-                    if (data.getLevel().isMoreSpecificThan(listener.getStatusLevel())) {
-                        listener.log(data);
-                    }
+            for (final StatusListener listener : listeners) {
+                if (data.getLevel().isMoreSpecificThan(listener.getStatusLevel())) {
+                    listener.log(data);
                 }
-            } else {
-                logger.logMessage(fqcn, level, marker, msg, t);
             }
         }
     }


[logging-log4j2] 04/05: If not needed.

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

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

commit 4f9c6cfcae3e2e214292a4b51f3e2ca0542538c4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 22 14:31:06 2020 -0500

    If not needed.
---
 .../org/apache/logging/log4j/core/config/ConfigurationSource.java   | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java
index 05382f1..3de940b 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java
@@ -321,11 +321,7 @@ public class ConfigurationSource {
         if (ConfigurationFactory.isClassLoaderUri(configLocation)) {
             final ClassLoader loader = LoaderUtil.getThreadContextClassLoader();
             final String path = ConfigurationFactory.extractClassLoaderUriPath(configLocation);
-            final ConfigurationSource source = fromResource(path, loader);
-            if (source != null) {
-                return source;
-            }
-            return null;
+            return fromResource(path, loader);
         }
         if (!configLocation.isAbsolute()) { // LOG4J2-704 avoid confusing error message thrown by uri.toURL()
             ConfigurationFactory.LOGGER.error("File not found in file system or classpath: {}", configLocation.toString());