Usually it's the Appender that should attach that information to the event,
after all, you want to know what application it's coming from. Right now
the JMSAppender does not append this information, like the Socket*Appender
is currently doing. Perhaps we should do something similar in JMSAppender?
It does pose an interesting feature idea, one of a LoggingEvent decorator
that a Receiver could be configured with. Let me explain in a coding
example:
public interface LoggingEventDecorator {
public void decorate(LoggingEvent e);
}
And then imagine that a Receiver had a
setLoggingEventDecorator(LoggingEventDecorator led) method.
At the point of receiving the event, the Receiver could call the Decorator
to decorate the event before it is posted into the local repository.
You could then, as an example inline with what you are after, configure a
Decorator to automatically add a particular element to the Properties,
should it not be there already.
But I think having JMSAppender add a property like the Socket one's would be
more consistent.
Thoughts?
Paul
> -----Original Message-----
> From: Stephen Pain [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 29, 2004 8:50 AM
> To: Log4J Developers List
> Subject: RE: pls patch JMSReceiver!
>
>
> Thanks Paul.
>
> I have made another change locally too - can anyone tell me whether I'm
> duplicating something that's already done somewhere else (but that I'm
> missing)?
>
> The change I made was to add the receiver name to logging events, to allow
> tabs to be created in chainsaw based on the name that has been chosen in
> the gui. I noticed this has been done in Generator.java, but didn't seem
> to be anywhere for "genuine" receivers.
>
> Any comments about performance overhead or any other reason why this
> shouldn't be done (for example "don't be stupid, you just need to..."),
> I'm happy to hear... or if others agree it's useful, the patch is below.
>
> Cheers,
> Stephen
>
>
> Index: Receiver.java
> ===================================================================
> RCS file: /home/cvspublic/logging-
> log4j/src/java/org/apache/log4j/plugins/Receiver.java,v
> retrieving revision 1.7
> diff -u -r1.7 Receiver.java
> --- Receiver.java 27 Feb 2004 16:47:33 -0000 1.7
> +++ Receiver.java 28 Jun 2004 22:40:54 -0000
> @@ -20,6 +20,7 @@
> import org.apache.log4j.Logger;
> import org.apache.log4j.spi.LoggingEvent;
> import org.apache.log4j.spi.Thresholdable;
> +import org.apache.log4j.helpers.Constants;
>
>
> /**
> @@ -104,6 +105,9 @@
> // configured repository.
> Logger localLogger =
> getLoggerRepository().getLogger(event.getLoggerName());
> +
> + event.setProperty(Constants.APPLICATION_KEY,getName());
>
> // if the logger level is greater or equal to the level
> // of the event, use the logger to append the event.
>
>
>
>
>
>
>
> "Paul Smith"
> <[EMAIL PROTECTED] To: "'Log4J
> Developers List'" <[EMAIL PROTECTED]>
> m> cc:
> Subject: RE: pls patch
> JMSReceiver!
> 28/06/2004 00:56
> Please respond to
> "Log4J Developers
> List"
>
>
>
>
>
>
> I've applied the patch to CVS (done by hand, I had bracket trouble due
> to lack of coffee this morning).
> Cheers,
>
> Paul Smith
>
> > -----Original Message-----
> > From: Stephen Pain [mailto:[EMAIL PROTECTED]
> > Sent: Monday, June 28, 2004 5:48 AM
> > To: Log4J Developers List
> > Subject: pls patch JMSReceiver!
> >
> >
> > Hi all,
> >
> > I'd really appreciate it if someone could apply the small patch below
> > which fixes problems I had when trying to connect to more than one
> > (weblogic) environment but where the topicFactoryName is the same across
> > the environments...
> >
> > Thanks!
> >
> > Cheers,
> > Stephen
> >
> > Index: JMSReceiver.java
> > ===================================================================
> > RCS file: /home/cvspublic/logging-
> > log4j/src/java/org/apache/log4j/net/JMSReceiver.java,v
> > retrieving revision 1.6
> > diff -u -r1.6 JMSReceiver.java
> > --- JMSReceiver.java 9 Jun 2004 09:31:33 -0000 1.6
> > +++ JMSReceiver.java 27 Jun 2004 19:30:00 -0000
> > @@ -163,7 +163,10 @@
> > JMSReceiver receiver = (JMSReceiver)testPlugin;
> >
> > // check for same topic name and super class equivalency
> > + // also check for jndi path - otherwise connecting to the same
> > + // topic factory name on different jms servers causes problems
> > return (topicFactoryName.equals(receiver.getTopicFactoryName())
> &&
> > + (jndiPath == null || jndiPath.equals(receiver.getJndiPath()))
> &&
> > super.isEquivalent(testPlugin));
> > }
> >
> >
> >
> > --
> >
> > This e-mail may contain confidential and/or privileged information. If
> you
> > are not the intended recipient (or have received this e-mail in error)
> > please notify the sender immediately and destroy this e-mail. Any
> > unauthorized copying, disclosure or distribution of the material in this
> > e-mail is strictly forbidden.
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
>
>
>
>
> --
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
>
>
> ---------------------------------------------------------------------
> 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]