I've created a JMSAppender as Michael stated, and a matching JMSReceiver.
The extension boils down to adding an optional layout to the
JMSAppender, and a decoder to the JMSReceiver. I personally use the
standard XMLLayout and XMLDecoder.

I can upload or include the files, what is standard procedure?

Mark van der Voort

On Tue, 15 Feb 2005 17:31:52 +0100, Ceki Gülcü <[EMAIL PROTECTED]> wrote:
> 
> Hi Michael,
> 
> Thank you for the contribution. However, I do not think it is suitable go
> into log4j proper. If another log4j committer is interested in placing it
> in log4j-sandbox and take responsibility for maintaining it, he is most
> welcome to do so.
> 
> In the mean time, my recommendation would be to set up a web page where
> interested users can download your contribution.
> 
> At 03:46 PM 2/15/2005, Michael Los wrote:
> >Please consider adding the capability to publish a text message via JMS.
> >When trying out the new Chainsaw, I was getting StreamCorruptedException.
> >I believe this was due to incompatible LoggingEvent serializations between
> >versions 1.2.x and 1.3
> >The event producer was using log4j 1.2.8.   Chainsaw v2 is using 1.3alpha...
> >
> >I intend to publish to a JMS topic using XMLLayout, but I suppose anything
> >would be reasonable.
> >Ultimately, the intent is for log messages to be published to a particular
> >JMS Topic.  In addition to "normal" listeners that will archive the log
> >messages, I intend to use Mule to listen on the topic and transform and send
> >messages to Chainsaw, which will receive them on its XMLSocketReceiver.
> >
> >I've included code for the JMS text appender I'm requesting.  If it were
> >rolled into JMSAppender, that would be fine with me, too.  In the v1.3
> >codebase, I noticed JMSReceiver.  I haven't made an effort to include
> >TextMessage support in that, yet.
> >
> >If I could have done all this a different way, let me know that, too.
> >
> >Regards,
> >Michael Los
> >
> >/**
> >  * Publishes a LoggingEvent to a JMS topic as a
> >  * JMS TextMessage.  The message text is formatted
> >  * according to the layout specified for the appender.
> >  *
> >  * @author <a href='[EMAIL PROTECTED]'>Michael Los</a>  MITRE
> >  */
> >public class JMSTextAppender extends JMSAppender
> >{
> >   /**
> >    * Prepares and publishes the LoggingEvent to the JMS destination
> >    * as a JMS Text message formatted with the configured Layout
> >    *
> >    * @see AppenderSkeleton#doAppend
> >    * @param event   event to be logged
> >   */
> >public void append(LoggingEvent event) {
> >   if(!checkEntryConditions()) {
> >    return;
> >   }
> >
> >   try {
> >     // topicSession is defined w/ package scope in JMSAppender
> >     TextMessage msg = topicSession.createTextMessage();
> >
> >     // Ensure location information exists, if available
> >     event.getLocationInformation();
> >
> >     msg.setText(layout.format(event));
> >
> >     topicPublisher.publish(msg);
> >   } catch(Exception e) {
> >      errorHandler.error("Could not publish message in JMSAppender
> >["+name+"].", e,
> >        ErrorCode.GENERIC_FAILURE);
> >   }
> >}
> >
> >}
> 
> --
> Ceki Gülcü
> 
>   The complete log4j manual: http://www.qos.ch/log4j/
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to