No problem
-----Original Message-----
From: Vivek Kapadekar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 7:17 PM
To: Log4J Users List
Subject: RE: Duplicate Triggering of custom appender.
Yup that worked, I think i had not set the additivity flag right..
Thanks for your help
--Viv
On Wed, 2003-06-11 at 16:54, Ebersole, Steven wrote:
Try the following just to see if you still get the same issue (and do
_not_
programatically add the appender):
######################################################################
# Define loggers
######################################################################
log4j.rootLogger=debug, stdout
log4j.additivity.rootLogger=false
log4j.logger.SYSTEM=DEBUG, soap
log4j.logger.AUDIT=DEBUG, soap
log4j.logger.TRANSACTION=DEBUG, soap
######################################################################
# Define appenders
######################################################################
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.soap=your.soap.appender.class.name
#... your appender's config parameters
-----Original Message-----
From: Vivek Kapadekar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 6:45 PM
To: Log4J Users List
Subject: RE: Duplicate Triggering of custom appender.
to SYSTEM, AUDIT and TRANSACTION
On Wed, 2003-06-11 at 16:41, Ebersole, Steven wrote:
To which loggers?
-----Original Message-----
From: Vivek Kapadekar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 6:39 PM
To: Log4J Users List
Subject: RE: Duplicate Triggering of custom appender.
Hi
The name of the appender I want to use is SOAPAppender and I add it
programmatically to the logger instances.
log4j.rootLogger=debug
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) -
%m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=deliveryModule.log
log4j.appender.JMS1=org.apache.log4j.net.JMSAppender
log4j.appender.JMS1.ProviderURL=ormi://localhost:6001
log4j.appender.JMS1.SecurityPrincipalName=admin
log4j.appender.JMS1.SecurityCredentials=bitfone
log4j.appender.JMS1.InitialContextFactoryName=com.evermind.server.Applicatio
nClientInitialContextFactory
log4j.appender.JMS1.TopicBindingName=jms/theTopic
log4j.appender.JMS1.TopicConnectionFactoryBindingName=jms/theTopicConnection
Factory
# Print only messages of level WARN or above in the package com.foo.
log4j.logger.SYSTEM=DEBUG
log4j.logger.AUDIT=DEBUG
log4j.logger.TRANSACTION=DEBUG
On Wed, 2003-06-11 at 16:29, Ebersole, Steven wrote:
What's your config look like?
-----Original Message-----
From: Vivek Kapadekar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 5:30 PM
To: Log4J Users List
Subject: RE: Duplicate Triggering of custom appender.
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]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]