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 2008/06/19 02:10:55 UTC

DO NOT REPLY [Bug 45231] New: Clear appenders call on logger calls a helper which calls close on the appenders

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

           Summary: Clear appenders call on logger calls a helper which
                    calls close on the appenders
           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: david.berkman@reardencommerce.com


Clear appenders call on logger calls a helper which calls close on the
appenders, even though appenders are shared objects and may still be active in
other loggers, or re-used later. You can't assume that removal equates to a
desire to close.


-- 
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 45231] Clear appenders call on logger calls a helper which calls close on the appenders

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


Curt Arnold <ca...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |ASSIGNED




--- Comment #4 from Curt Arnold <ca...@apache.org>  2009-01-08 09:09:50 PST ---
There is enough info to address the bug, so I'm dropping the NEEDINFO
designation.

The behavior described is undesirable but long established.  I don't think that
removing the "a.close()" would be acceptable since some app might depend on
removeAllAppenders() closing the appenders.  However, I could see only closing
the appenders that are not otherwise attached, however detecting that might be
complicated.


-- 
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 45231] Clear appenders call on logger calls a helper which calls close on the appenders

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


Thorbjørn Ravn Andersen <th...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




-- 
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 45231] Clear appenders call on logger calls a helper which calls close on the appenders

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


Thorbjørn Ravn Andersen <th...@gmail.com> changed:

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




--- Comment #3 from Thorbjørn Ravn Andersen <th...@gmail.com>  2008-07-03 16:47:35 PST ---
(In reply to comment #2)

> You've got to be kidding. It's directly in your code. Here's the stack trace...

I am not kidding, and it is not my code (you can see that in the Subversion
history).  By providing a testcase it can be demonstrated that the bug exists,
and that the patch removed the bug.  Otherwise we can only guess what caused
the bug and if the handwaving code introduced fixed it in the way you expected.

Hence, please provide a testcase.

> In my opinion this is incorrect behavior.

Most likely. 


-- 
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 45231] Clear appenders call on logger calls a helper which calls close on the appenders

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





--- Comment #2 from David Berkman <da...@reardencommerce.com>  2008-07-03 14:32:48 PST ---
(In reply to comment #1)
> Please attach a testcase demonstrating the behaviour you are reporting.
> 

You've got to be kidding. It's directly in your code. Here's the stack trace...

        at
org.apache.log4j.helpers.AppenderAttachableImpl.removeAllAppenders(AppenderAttachableImpl.java:141)
at org.apache.log4j.Category.removeAllAppenders(Category.java:891)

Calling Category.removeAllAppenders() results in a call to
AppenderAttachableImpl.removeAllAppenders(), probably because this is set as
the default listener for the remove event internally. Looking at the code fro
the removeAllAppenders method in AppenderAttachableImpl, we see...

  public
  void removeAllAppenders() {
    if(appenderList != null) {
      int len = appenderList.size();      
      for(int i = 0; i < len; i++) {
        Appender a = (Appender) appenderList.elementAt(i);
        a.close();
      }
      appenderList.removeAllElements();
      appenderList = null;      
    }
  }

Look at that a.close(). Why is this method calling close on an Appender simply
because it has been removed from a logger? Appenders are shared objects. I
wonder how the other loggers that Appender is attached to will feel about it
being closed underneath them? What happens when I re-use this Appender?

In my opinion this is incorrect behavior.


-- 
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 45231] Clear appenders call on logger calls a helper which calls close on the appenders

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





--- Comment #1 from Thorbjørn Ravn Andersen <th...@gmail.com>  2008-07-03 13:37:24 PST ---
Please attach a testcase demonstrating the behaviour you are reporting.


-- 
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