You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "FLYNN, Peter -Syntegra UK" <Pe...@syntegra.com> on 2002/11/20 10:31:40 UTC

Rendered Message in JMSAppender messages

Hi,

Here is my configuration (in XML) of my JMS Appender:

<appender name="JMS" class="org.apache.log4j.net.JMSAppender">
   <param name="TopicConnectionFactoryBindingName"
value="cn=LoggingTopicConnectionFactory"/>
   <param name="TopicBindingName" value="cn=LoggingTopic"/>
   <param name="Threshold" value="DEBUG"/>
   <layout class="org.apache.log4j.PatternLayout">
     <param name="ConversionPattern" value="[%-5p] [%d{DATE}] [%C.%M] -
%m%n"/>
   </layout>
</appender>

As you can see I'm using PatternLayout.  The message is sent out onto JMS as
a serialised java object (org.apache.log4j.spi.LoggingEvent) wrapped in an
javax.jms.ObjectMessage.

On the class org.apache.log4j.spi.LoggingEvent, I can use methods
getMessage() and getRenderedMessage().  

Both return the %m message string, but I would expect getRenderedMessage()
to return the rendered message as defined in the layout in the
configuration.  

Is this a bug, as the message should have been rendered before sending the
message out on the JMS appender?

Regards,
Peter


********************************************************************

This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person
Thank you

Check us out at http://www.syntegra.com

********************************************************************


Re: Rendered Message in JMSAppender messages

Posted by Ceki Gülcü <ce...@qos.ch>.
Message rendering is done prior to serialization. After serialization 
calling getMessage and getRenderedMessage always give the same result 
regardless of how you configure the server (receiving) side. Object 
rendering should be configured on the clients. HTH,


At 09:31 20.11.2002 +0000, FLYNN, Peter -Syntegra UK wrote:
>Hi,
>
>Here is my configuration (in XML) of my JMS Appender:
>
><appender name="JMS" class="org.apache.log4j.net.JMSAppender">
>    <param name="TopicConnectionFactoryBindingName"
>value="cn=LoggingTopicConnectionFactory"/>
>    <param name="TopicBindingName" value="cn=LoggingTopic"/>
>    <param name="Threshold" value="DEBUG"/>
>    <layout class="org.apache.log4j.PatternLayout">
>      <param name="ConversionPattern" value="[%-5p] [%d{DATE}] [%C.%M] -
>%m%n"/>
>    </layout>
></appender>
>
>As you can see I'm using PatternLayout.  The message is sent out onto JMS as
>a serialised java object (org.apache.log4j.spi.LoggingEvent) wrapped in an
>javax.jms.ObjectMessage.
>
>On the class org.apache.log4j.spi.LoggingEvent, I can use methods
>getMessage() and getRenderedMessage().


>Both return the %m message string, but I would expect getRenderedMessage()
>to return the rendered message as defined in the layout in the
>configuration.
>
>Is this a bug, as the message should have been rendered before sending the
>message out on the JMS appender?
>
>Regards,
>Peter

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>