Bug 44555

Summary: com.apache.log4j.varia.NullAppender lack static accessor to static instance
Product: Log4j - Now in Jira Reporter: Ola Mattsson <ola.mattsson>
Component: AppenderAssignee: log4j-dev <log4j-dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: patch to make getInstance() static.

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.