You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Duseja, Sushil" <Su...@fiserv.co.in> on 2008/02/05 06:46:40 UTC

Web Service Appender

Hello,

 

I am a newbie as far as web services and log4j are concerned. I want to
write a web service appender using Axis and log4j. This appender should
be able to call the web service. 

 

Here's what I have done:- 

 

1) Created a service named MyService, using Axis, and deployed it
successfully in tomcat.

2) Created a remote appender class MyAppender by extending
AppenderSkeleton class. 

3) Created a main class LogClass having loggers.

4) Created log4j.properties file so as to call MyAppender.

 

While running the main class, it seems as if the append() method is
being called multiple times, which in turn creates multiple
org.apache.axis.client.Service objects and that leads to the following
exception:-

 

message
=getBundle(org.apache.axis,org.apache.axis.i18n,resource,null,...)

java.lang.NullPointerException

 

message =loadBundle: Ignoring MissingResourceException: Can't find
bundle for base name org.apache.axis.resource, locale en_US

java.lang.NullPointerException

 

message =Created org.apache.axis.i18n.resource, linked to parent null

java.lang.NullPointerException

 

message
=getBundle(org.apache.axis,org.apache.axis.i18n,resource,null,...)

 

The program eventually terminates by throwing - Exception in thread
"main" java.lang.StackOverflowError

 

 

Moreover, this web service is working absolutely fine when invoked from
a class having just a main method. The above problem occurs when the
same piece of code is moved inside a private method
(executeWebService()) and the method is called from the append() method
of the appender (MyAppender). Could anyone please point me to the
problem with the appender (MyAppender)?

 

My Queries:-

1) Has it anything to do with the lifecycle of append() method? If yes,
could someone elaborate on its lifecycle?

2) If this is not the correct way of writing a web service appender
using log4j (given that the service is deployed in tomcat), how can I do
so correctly?

 

Thanking you in anticipation.

 

Regards,

Sushil Duseja

 

PS: All the files discussed are attached with the mail.


Re: Web Service Appender

Posted by Eelke Blok <lo...@blokspeed.net>.
On Feb 5, 2008 6:46 AM, Duseja, Sushil <Su...@fiserv.co.in> wrote:
> While running the main class, it seems as if the append() method is being
> called multiple times

I'm not sure if I'm misunderstanding you, but it is perfectly normal
for the append method to be called multiple times; it will be called
each time a log event reaches the appender.

If you mean it's called multiple times per log event, this might be
due to the logger configuration. For example, if you attach the same
appender to the root logger, as well as to a logger higher up the
tree, log events that originate from that particular branch will be
appended twice. However, also that situation should "just" cause the
log event to be logged twice, it should not be causing problems like
you're seeing.

Regards,

Eelke

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org