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

Jeff Thomas commented on LOG4J2-3665:
-------------------------------------

Closing old issues created by me in old issue tracker.

If this issue comes up for me again, I will create a new issue in the Github 
issue trracker.

Thanks :)

> Dynamically created loggers do not respect "Named Hierarchy"
> ------------------------------------------------------------
>
>                 Key: LOG4J2-3665
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3665
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.20.0
>         Environment: Windows
> Java 17 (Temurin)
> Log4j 2.20.0
>            Reporter: Jeff Thomas
>            Priority: Major
>
> I hope I am interpreting this correctly... :(
> I am getting a non-configured logger at runtime via the API.
> {code:java}
> LogManager.getLogger("foobar"){code}
> This logger doesn't exist on the first call and gets dynamically created in 
> the context with its parent as the root logger.  From this point on I can set 
> the level and it is persisted in the context.
> So then I get another unconfigured logger:
> {code:java}
> LogManager.getLogger("foobar.a"){code}
> This creates another dynamic logger but if I check its parent, the parent is 
> not the "foobar" logger I created first, but again the root logger.
> According to the documentation 
> ([https://logging.apache.org/log4j/2.x/manual/architecture.html#logger-hierarchy),]
>  
> {panel:title=Named Hierarchy}
> A LoggerConfig is said to be an _ancestor_ of another LoggerConfig if its 
> name followed by a dot is a prefix of the _descendant_ logger name. A 
> LoggerConfig is said to be a _parent_ of a _child_ LoggerConfig if there are 
> no ancestors between itself and the descendant LoggerConfig. 
> {panel}
> So it doesn't seem to be adhering to this "Named Hierarchy" rule.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to