[ 
https://issues.apache.org/jira/browse/LOG4J2-3631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Piotr Karwasz resolved LOG4J2-3631.
-----------------------------------
    Fix Version/s: 2.19.1
       Resolution: Fixed

Hi [~JWT007],

Thank you for reporting this issue. It should be fixed in the latest 
{{2.19.1-SNAPSHOT}} available at 
{{{}[https://repository.apache.org/content/groups/snapshots/]{}}}. Can you 
check if it fixes the problem and close the issue.

Regarding your question: no {{LoggerConfig}} should ever be created if you call 
{{{}LogManager#getLogger{}}}. If it does, it is a bug worth reporting.

> Different handling for "getLogger(Class)" and 
> "Configurator.setLevel(Class,Level)" on inner class
> -------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-3631
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3631
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.19.0
>         Environment: Java 11 (Temurin)
> Maven
>            Reporter: Jeff Thomas
>            Assignee: Piotr Karwasz
>            Priority: Minor
>             Fix For: 2.19.1
>
>
> I have created a sample project with a simple JUnit test here:
> [https://github.com/JWT007/log4j2_logLevelClass]
> Basically I have an inner class and when I get a logger for that class I get 
> the logger named.
> {{Log4jLevelTest.InnerClass}}
> and I can see its associated LoggerConfig of the same name.
> If I call "Configurator.setLevel(InnerClass.class, Level.DEBUG)" it does not 
> change the level of my logger but rather creates a new LoggerConfig with the 
> following name:
> {{Log4jLevelTest$InnerClass}}
> Here the output of my sample test:
>  
> {code:java}
>  
> ==================================================================================
> Class name                :: Log4jLevelTest$InnerClass
>  
> ==================================================================================
> Logger name               :: Log4jLevelTest.InnerClass
> Logger level              :: INFO
> Configured Loggers (1)    :: 
>   o Log4jLevelTest.InnerClass(INFO)
>  
> ==================================================================================
> >> Configurator.setLevel(Inner.class, Level.DEBUG)
> Logger name               :: Log4jLevelTest.InnerClass
> Logger level              :: INFO
> Configured Loggers (1)    :: 
>   o Log4jLevelTest.InnerClass(INFO)
>   o Log4jLevelTest$InnerClass(DEBUG)
> {code}
>  



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

Reply via email to