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 Michael Los <me...@mitre.org> on 2005/02/15 15:46:40 UTC

jms text msg appender

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='mel@mitre.org'>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);
  }
}
 
}

Re: jms text msg appender

Posted by Mark van der Voort <ma...@gmail.com>.
Sure,

I wrote it for incompany use so I'll have to maintain it anyway.
Better a general version than a proprietary one.

Mark van der Voort

On Fri, 18 Feb 2005 19:45:40 +0100, Ceki Gülcü <ce...@qos.ch> wrote:
> 
> Michael, Mark (van der Voort),
> 
> Do you have an interest in maintaining the JMSAppender/JMSReceiver pair?
> 
> At 09:39 AM 2/16/2005, Mark van der Voort wrote:
> >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ü <ce...@qos.ch> 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='mel@mitre.org'>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: log4j-dev-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-dev-help@logging.apache.org
> > >
> > >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> >For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> --
> Ceki Gülcü
> 
>    The complete log4j manual: http://www.qos.ch/log4j/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
>

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


Re: jms text msg appender

Posted by Mark van der Voort <ma...@gmail.com>.
Ceki,

Both Michael and I have expressed an interest in maintaining the
JMSAppender/JMSReceiver pair.

What are we to do next?

Mark


On Fri, 18 Feb 2005 19:45:40 +0100, Ceki Gülcü <ce...@qos.ch> wrote:
> 
> Michael, Mark (van der Voort),
> 
> Do you have an interest in maintaining the JMSAppender/JMSReceiver pair?
> 
> At 09:39 AM 2/16/2005, Mark van der Voort wrote:
> >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ü <ce...@qos.ch> 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='mel@mitre.org'>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: log4j-dev-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-dev-help@logging.apache.org
> > >
> > >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> >For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> --
> Ceki Gülcü
> 
>   The complete log4j manual: http://www.qos.ch/log4j/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
>

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


Re: jms text msg appender

Posted by Ceki Gülcü <ce...@qos.ch>.
Michael, Mark (van der Voort),

Do you have an interest in maintaining the JMSAppender/JMSReceiver pair?

At 09:39 AM 2/16/2005, Mark van der Voort wrote:
>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ü <ce...@qos.ch> 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='mel@mitre.org'>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: log4j-dev-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-dev-help@logging.apache.org
> >
> >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-dev-help@logging.apache.org

-- 
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/



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


Re: jms text msg appender

Posted by Mark van der Voort <ma...@gmail.com>.
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ü <ce...@qos.ch> 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='mel@mitre.org'>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: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
>

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


Re: jms text msg appender

Posted by Ceki Gülcü <ce...@qos.ch>.
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='mel@mitre.org'>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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org