You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Nick Williams (JIRA)" <ji...@apache.org> on 2013/04/30 14:00:20 UTC
[jira] [Commented] (LOG4J2-231) Logger.getParent
[ https://issues.apache.org/jira/browse/LOG4J2-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13645511#comment-13645511 ]
Nick Williams commented on LOG4J2-231:
--------------------------------------
That doesn't look right to me, either. The whole thing seems kind of wonky. I'm not sure exactly what the right answer is, but I think that middle part should be this:
if (context.hasLogger(lc.getName())) {
return context.getLogger(lc.getName(), getMessageFactory()); // <-------
}
But I don't purport to understand how everything works in this codebase. I could certainly be wrong. :-)
> Logger.getParent
> -----------------
>
> Key: LOG4J2-231
> URL: https://issues.apache.org/jira/browse/LOG4J2-231
> Project: Log4j 2
> Issue Type: Question
> Components: Core, log4j 1.2 emulation
> Affects Versions: 2.0-beta5
> Reporter: Remko Popma
>
> Not 100% sure, but this code looked a bit strange:
> (o.a.l.l.core.Logger line 65)
> public Logger getParent() {
> final LoggerConfig lc = config.loggerConfig.getParent();
> if (lc == null) {
> return null;
> }
> if (context.hasLogger(lc.getName())) {
> return context.getLogger(getName(), getMessageFactory()); // <-------
> }
> return new Logger(context, getName(), this.getMessageFactory()); // <-------
> }
> the last two return statements use the name of *this* logger instead of the parent name lc.getName().
> Is that correct?
> (this method is not used in core internally but is used in the logtj12-api module, by Category#getParent)
> I'll try to write a JUnit test for this later, still need to figure out how.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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