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 2022/01/13 14:39:00 UTC

[logging-log4j2] branch master updated (eabd2f3 -> ebcadcc)

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

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


    from eabd2f3  Simplify exception handling.
     new 6815d62  Add ContextUtil.shutdown(LoggerContext) and Javadoc.
     new ebcadcc  Simplify exception handling.

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/log4j/helpers/OptionConverter.java  |  3 +--
 .../org/apache/log4j/legacy/core/ContextUtil.java  | 26 +++++++++++++++++-----
 2 files changed, 22 insertions(+), 7 deletions(-)

[logging-log4j2] 02/02: Simplify exception handling.

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

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

commit ebcadcce14609d5d944866728be3edebdeb9b225
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jan 13 09:24:27 2022 -0500

    Simplify exception handling.
---
 .../src/main/java/org/apache/log4j/helpers/OptionConverter.java        | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/OptionConverter.java b/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/OptionConverter.java
index 3090a9d..c9e49b0 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/OptionConverter.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/OptionConverter.java
@@ -213,8 +213,7 @@ public class OptionConverter {
                     return defaultValue;
                 }
                 return obj;
-            } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException
-                    | InstantiationException | InvocationTargetException e) {
+            } catch (ReflectiveOperationException e) {
                 LOGGER.error("Could not instantiate class [" + className + "].", e);
             }
         }

[logging-log4j2] 01/02: Add ContextUtil.shutdown(LoggerContext) and Javadoc.

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

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

commit 6815d628e62c5b219357e6f5ade9f59630617dbb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jan 13 09:18:32 2022 -0500

    Add ContextUtil.shutdown(LoggerContext) and Javadoc.
---
 .../org/apache/log4j/legacy/core/ContextUtil.java  | 26 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/legacy/core/ContextUtil.java b/log4j-1.2-api/src/main/java/org/apache/log4j/legacy/core/ContextUtil.java
index d3b99fa..8980980 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/legacy/core/ContextUtil.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/legacy/core/ContextUtil.java
@@ -19,16 +19,32 @@ package org.apache.log4j.legacy.core;
 import org.apache.logging.log4j.spi.LoggerContext;
 
 /**
- * Implements LoggerContext methods specific to log4j-core.
+ * Delegates to {@code LoggerContext} methods implemented by {@code log4j-core} if appropriate.
  */
 public final class ContextUtil {
 
-    private ContextUtil() {
+    /**
+     * Delegates to {@link org.apache.logging.log4j.core.LoggerContext#reconfigure()} if appropriate.
+     * 
+     * @param loggerContext The target logger context.
+     */
+    public static void reconfigure(LoggerContext loggerContext) {
+        if (loggerContext instanceof org.apache.logging.log4j.core.LoggerContext) {
+            ((org.apache.logging.log4j.core.LoggerContext) loggerContext).reconfigure();
+        }
     }
 
-    public static void reconfigure(LoggerContext ctx) {
-        if (ctx instanceof org.apache.logging.log4j.core.LoggerContext) {
-            ((org.apache.logging.log4j.core.LoggerContext) ctx).reconfigure();
+    /**
+     * Delegates to {@link org.apache.logging.log4j.core.LoggerContext#close()} if appropriate.
+     * 
+     * @param loggerContext The target logger context.
+     */
+    public static void shutdown(LoggerContext loggerContext) {
+        if (loggerContext instanceof org.apache.logging.log4j.core.LoggerContext) {
+            ((org.apache.logging.log4j.core.LoggerContext) loggerContext).close();
         }
     }
+
+    private ContextUtil() {
+    }
 }