You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Peter <th...@yahoo.com> on 2005/09/27 20:11:04 UTC

JMSAppender and remote hostname

Hello,

Apologies in advance if this is not the correct list. 

I see no clear cut way to retrieve the remost hostname
of  my log4j clients using the JMSAppender at the
message consumer(s). 

I guess there are two quick ways of doing it, using
MDC or using a JMS object message's string property.
Latter might actually be a little more lightweight but
for now I have used the former. 

I'm not really familiar with the log4j internals but
seeing as the MDC is set per thread and I assume only
one instance of the JMSAppender is instantiated from a
static initializer somewhere, the JMSAppender
constructor would be the right place to do this. All
threads should hopefully inherit this. 

I still need to profile both approaches and see which
is most efficient, every bit of performance is
important to us in this situation. Incidentally, I've
found LoggingEvent.getThrowableStrRep() to be a huge
performance hit, nearly halved our throughput, it
seems that it's performed in a rather convoluted way
which I don't know the reasoning behind and could be
done a bit faster using a simple StringBuffer. But I
digress...

Attached is a basic patch.

Thanks
Peter