You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/04/09 21:16:00 UTC

[jira] [Commented] (LOG4J2-3440) Log4j 1.2 bridge getAllAppenders() returns null enumeration

    [ https://issues.apache.org/jira/browse/LOG4J2-3440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17520025#comment-17520025 ] 

ASF subversion and git services commented on LOG4J2-3440:
---------------------------------------------------------

Commit dfc215713abbd211e60a81074f177f49bbd9e406 in logging-log4j2's branch refs/heads/release-2.x from Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=dfc215713a ]

[LOG4J2-3440] Synchronize Log4j 1.x and Log4j 2.x appenders

Forwards the `addAppender`, `callAppenders`, `getAllAppenders` and
`getAppender` calls the the corresponding Log4j 2.x objects if Log4j 2.x
Core is present.

The `getAllAppenders` method only returns those appenders, which are
attached to homonymous logger config and are native Log4j 1.x appenders.

> Log4j 1.2 bridge getAllAppenders() returns null enumeration
> -----------------------------------------------------------
>
>                 Key: LOG4J2-3440
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3440
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Log4j 1.2 bridge
>    Affects Versions: 2.17.2
>            Reporter: Pablo Rogina
>            Assignee: Piotr Karwasz
>            Priority: Major
>             Fix For: 2.17.3
>
>
> Old application using Log4j 1.2.x relies on Logger.getAllAppenders() to decide if Log4j it's already configured (returned Enumeration has at least 1 appender) or not (empty returned Enumeration).
> Some recent code audits mandate to remove log4j v1 component(s) and to upgrade to latest 2.17.2 release, so we're using Log4j 1.2 Bridge to comply and not to change application code.
> However, we're facing the issue describe here [1] for Logger.getRootLogger().getAllAppenders() although with latest Log4j release 2.17.2 the issue seems to be that data structure aai is never updated with the proper configured appenders, given that now most of the work happens in the Log4j v2 Core implementation, thus using LoggerContext
> [1] [java - Log4j getAllAppenders() returns null enumeration - Stack Overflow|https://stackoverflow.com/questions/32864929/log4j-getallappenders-returns-null-enumeration]
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)