Bug 44555 - com.apache.log4j.varia.NullAppender lack static accessor to static instance
Summary: com.apache.log4j.varia.NullAppender lack static accessor to static instance
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Appender (show other bugs)
Version: 1.2
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
Depends on:
Reported: 2008-03-07 05:32 UTC by Ola Mattsson
Modified: 2008-08-12 14:04 UTC (History)
0 users

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.