Bug 44555 - com.apache.log4j.varia.NullAppender lack static accessor to static instance
com.apache.log4j.varia.NullAppender lack static accessor to static instance
Status: RESOLVED FIXED
Product: Log4j
Classification: Unclassified
Component: Appender
1.2
PC Windows XP
: P2 normal
: ---
Assigned To: log4j-dev
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-03-07 05:32 UTC by Ola Mattsson
Modified: 2008-08-12 14:04 UTC (History)
0 users



Attachments
patch to make getInstance() static. (604 bytes, patch)
2008-08-02 14:22 UTC, Thorbjørn Ravn Andersen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ola Mattsson 2008-03-07 05:32:00 UTC
I noticed that the NullAppender class have a private static NullAppender instance variable, which is supposed to let you avoid creating new NullAppender instances whenever you need one. But the getInstance method that is supposed to return the instance is not static, so you have to first create a new NullAppender before you can get the static instance.
Seems kinda pointless, doesn't it?
Comment 1 Thorbjørn Ravn Andersen 2008-08-02 14:22:43 UTC
Created attachment 22348 [details]
patch to make getInstance() static.
Comment 2 Curt Arnold 2008-08-12 14:04:14 UTC
Changing getInstance() from a member method to a static method would be an API change.  There is the unlikely possibility that someone overloaded the method and would not take kindly to the change.  I added a static getNullAppender() method and marked getInstance() as deprecated.