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

John Vasileff updated LOG4J2-50:
--------------------------------

    Attachment: 0004-cleanup-FQCN-code.patch

Comments for 0004.patch

cleanup FQCN code

Make sure all application facing log methods use their own FQCN.  This patch
resolves a unit test failure for the %C pattern when using the Category logger.

The AbstractLogger method:

String getFQCN()

was removed.  Previously, subclasses were able to override this method which
caused incorrect location data when AbstractLogger log methods were called
directly by application code (i.e. not overridden by the subclass).

Subclasses of AbstractLoggerWrapper that introduce their own log methods should 
call:

log(Marker marker, String fqcn, Level level, Message data, Throwable t);

where fqcn is Subclass.getName();


> Incorrect %C output (FQCN) 
> ---------------------------
>
>                 Key: LOG4J2-50
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-50
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>            Reporter: John Vasileff
>            Assignee: Ralph Goers
>         Attachments: 0004-cleanup-FQCN-code.patch
>
>
> The fully qualified class name must be set correctly to support conversions 
> like %C.  In some cases, %C information is incorrect.  I think this is 
> related to AbstractLogger allowing getFQCN() to be overridden.  Log methods 
> handled by AbstractLogger should have AbstractLogger's FQCN, not that of the 
> subclass.
> Example:
> slf4jLogger.info("slf4jLogger test %C."); // works; SLF4JLogger overrides 
> this method
> slf4jLogger.info("slf4jLogger test %C.", t); // fails with '?'; handled by 
> AbstractLogger
> category2.info("category test %C"); // fails with 'o.a.l.Category'
> Output:
> INFO Log4j2Testing [main] slf4jLogger test %C.
> INFO ? [main] slf4jLogger test %C.
>  java.lang.Throwable
>       at Log4j2Testing.main(Log4j2Testing.java:22)
> INFO o.a.l.Category [main] category test %C

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to