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 bu...@apache.org on 2010/10/27 17:44:40 UTC

DO NOT REPLY [Bug 50164] New: getAppender method in Logger class doesn't return inherited appenders when using a configuration file

https://issues.apache.org/bugzilla/show_bug.cgi?id=50164

           Summary: getAppender method in Logger class doesn't return
                    inherited appenders when using a configuration file
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: liorz1984@gmail.com


Example; I will describe an easily reproduced configuration scheme:

Logger A contains appender1, appender2.
Logger A.B contains appender3.

When calling B.getAppender("appender1") we get a null pointer.
To verify this problem one can call Logger.getLogger("A.B").getAllAppenders() -
only appender3 is being returned.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 50164] getAppender method in Logger class doesn't return inherited appenders when using a configuration file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50164

--- Comment #1 from Ralph Goers <Ra...@dslextreme.com> 2010-10-27 17:11:15 EDT ---
This is strictly my opinion, but:
1. The bug here is that getAppender() is a public method on a logger. It is
really an internal method used by Log4j that is exposed publicly due to the way
Log4j was implemented and 2. This is the correct behavior. 

Log4j 1.2 calls getAppender for each Appender attached to the logger. After
doing so, if the logger is "additive" it calls delegates to the parent's logger
where the same process is followed until it either reaches a logger which isn't
additive or processes the root logger.  The change you are requesting would
cause log4j to process appenders differently than it currently does.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 50164] getAppender method in Logger class doesn't return inherited appenders when using a configuration file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50164

Lior Zimmerman <li...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |liorz1984@gmail.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 50164] getAppender method in Logger class doesn't return inherited appenders when using a configuration file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50164

--- Comment #2 from Lior Zimmerman <li...@gmail.com> 2010-10-27 17:39:57 EDT ---
Well, I find this behavior handy if you have a custom appender that needs to
get some parameters manually.
For example, I can set the root logger to contain my custom appender, and then
call getAppender("myCustomAppender") on each logger I register, and customize
its parameters as I please.
But this is strictly my opinion, and for the record - I have no idea how
complicated/efficient it will be to implement it, as I only shortly skimmed the
relevant code segment of log4j's code.

> This is strictly my opinion, but:
> 1. The bug here is that getAppender() is a public method on a logger. It is
> really an internal method used by Log4j that is exposed publicly due to the way
> Log4j was implemented and 2. This is the correct behavior. 
> 
> Log4j 1.2 calls getAppender for each Appender attached to the logger. After
> doing so, if the logger is "additive" it calls delegates to the parent's logger
> where the same process is followed until it either reaches a logger which isn't
> additive or processes the root logger.  The change you are requesting would
> cause log4j to process appenders differently than it currently does.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org