i have set it to false for that particular Logger instance.
On Wed, 2003-06-11 at 15:22, Ebersole, Steven wrote:
Make sure you dont have an additivity issue.
-----Original Message-----
From: Vivek Kapadekar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 5:21 PM
To: [EMAIL PROTECTED]
Cc: Log4J Users List
Subject: Re: Duplicate Triggering of custom appender.
Hi
Below is the appender code. As you see there is not a lot of
implementation details in the appender. The append() method gets
triggered twice the number of times I log messages...
public class SOAPAppender extends AppenderSkeleton implements
org.apache.log4j.Appender {
/**
* A static Object that maintains message batch
*/
private static ArrayList messages = new ArrayList();
public static int hits = 0;
public SOAPAppender() {
super();
}
public void append(LoggingEvent parm1) {
Object obj = parm1.getMessage();
LogMessageBase logObj = null;
System.out.println(" Appender Triggered ");
hits++;
synchronized ( messages ) {
if ( messages.size() == 20 ) {
messages.add(obj);
System.out.println("Now make a soap call: with message list
size : " + messages.size()
+ " and clear the List of messages");
messages.clear();
}
else {
messages.add(obj);
}
}
System.out.println(" This was the " + hits + " hit. ");
/[EMAIL PROTECTED] Implement this org.apache.log4j.AppenderSkeleton abstract
method*/
}
public boolean requiresLayout() {
return true;
}
public void close() {
/[EMAIL PROTECTED] Implement this org.apache.log4j.Appender abstract method*/
}
}
On Wed, 2003-06-11 at 15:05, Yoav Shapira wrote:
Howdy,
It would be easier (for me at least ;)) to diagnose your problem if you
post
the source code to your appender...
Yoav Shapira
--- Vivek Kapadekar <[EMAIL PROTECTED]> wrote:
> Hi
> I have written my own simple appender ( this is the first time I am
> writing an appender). I attach the appender to the Logger using
> addAppender(). In my client class I log six messages, but what the
> appenders append() method gets triggered 12 times. I thought it might
> be due to the hierarchy , and the duplicate perhaps was made by the
> rootLogger, but i have set the additivity flag to false, still I get
> duplicate hits to my appender.
> Can anybody shed light on this?
>
> Thanks
>
> --Vivek
>
>
=====
Yoav Shapira
[EMAIL PROTECTED]
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]