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/03/12 12:31:48 UTC

[logging-log4j2] branch release-2.x updated: [LOG4J2-3040] Avoid ClassCastException in JeroMqManager with custom LoggerContextFactory (#791)

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


The following commit(s) were added to refs/heads/release-2.x by this push:
     new 67ba1fe  [LOG4J2-3040] Avoid ClassCastException in JeroMqManager with custom LoggerContextFactory (#791)
67ba1fe is described below

commit 67ba1fe05951e20cb9c29b47a1b1e8a6d8e2e181
Author: Grzegorz Grzybek <gr...@gmail.com>
AuthorDate: Sat Mar 12 13:31:38 2022 +0100

    [LOG4J2-3040] Avoid ClassCastException in JeroMqManager with custom LoggerContextFactory (#791)
    
    Signed-off-by: Grzegorz Grzybek <gr...@gmail.com>
---
 .../apache/logging/log4j/core/appender/mom/jeromq/JeroMqManager.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqManager.java
index 327d9b1..2d20a53 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/jeromq/JeroMqManager.java
@@ -61,7 +61,7 @@ public class JeroMqManager extends AbstractManager {
 
         final boolean enableShutdownHook = PropertiesUtil.getProperties().getBooleanProperty(
             SYS_PROPERTY_ENABLE_SHUTDOWN_HOOK, true);
-        if (enableShutdownHook) {
+        if (enableShutdownHook && LogManager.getFactory() instanceof ShutdownCallbackRegistry) {
             SHUTDOWN_HOOK = ((ShutdownCallbackRegistry) LogManager.getFactory()).addShutdownCallback(CONTEXT::close);
         } else {
             SHUTDOWN_HOOK = null;