Bug 47141 - add getCyclicBuffer() method to log4j SMTPAppender
Summary: add getCyclicBuffer() method to log4j SMTPAppender
Status: NEEDINFO
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Appender (show other bugs)
Version: 1.2
Hardware: PC All
: P2 enhancement
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-02 14:53 UTC by Sean C. Sullivan
Modified: 2009-05-17 16:54 UTC (History)
0 users



Attachments
patch for SMTPAppender.java (1.92 KB, text/plain)
2009-05-02 14:54 UTC, Sean C. Sullivan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sean C. Sullivan 2009-05-02 14:53:18 UTC
I am submitting a patch for log4j's SMTPAppender.

The patch has two changes:

1) new method:    protected CyclicBuffer getCyclicBuffer()

2) SMTPAppender uses getCyclicBuffer() whenever it needs to access the buffer object


This change makes it easier for third parties to subclass (extend) SMTPAppender.
Comment 1 Sean C. Sullivan 2009-05-02 14:54:18 UTC
Created attachment 23597 [details]
patch for SMTPAppender.java
Comment 2 Curt Arnold 2009-05-11 21:23:22 UTC
I don't see how the benefit of the mod.   The cb member is protected and non-final, so if you wanted to replace the current implementation with your own CyclicBuffer implementation, you could do it in either the constructor or activateOptions.  Could you explain the use case?
Comment 3 Sean C. Sullivan 2009-05-17 16:54:43 UTC
The use case is that I plan to maintain a CyclicBuffer per Thread.   

If there were a getCyclicBuffer() method, I would be able to do this:


   protected CyclicBuffer getCyclicBuffer()
   {
       return threadLocalCyclicBuffer.get();
   }