logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Vasileff (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (LOG4J2-50) Incorrect %C output (FQCN)
Date Mon, 19 Sep 2011 01:18:09 GMT

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

John Vasileff reopened LOG4J2-50:
---------------------------------


Actually, in the original report I was using log4j12-api.  It was a puzzle to determine why
your test passed while mine failed.  My code looked like:

import org.apache.log4j.Category;

private static final org.apache.logging.log4j.Logger log4j2Logger = LogManager.getLogger(Log4j2Testing.class.getName());
private static final Category category2 = Category.getInstance(Log4j2Testing.class);

...

As it turns out, the order in which the loggers were created changed the result.  See LOG4J2-51.
 I was able to get correct results by flipping the order of the getLogger/getInstance calls.

In your patch for the SLF4J API, the problems with slf4jLogger are resolved since SLF4JLogger
no longer extends AbstractLogger.  But a problem remains with the getFQCN() logic.

I have a patch to correct this.  It builds on the patches in LOG4J2-51.  Note: LOG4J2-51 temporarily
causes your new test case to fail, but the forthcoming patch fixes the root cause.

> 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
>
> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message