logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <psm...@aconex.com>
Subject Re: Using Layouts with JMSAppender
Date Tue, 07 Feb 2006 00:39:44 GMT
In your MDB, just have an instance of a Layout and format it then.

Otherwise you don't want to use JMSAppender.  JMSAppender is about  
sending the binary contents of the LoggingEvent over JMS for some  
other reason (say, to view in a GUI, or store in a DB).

Paul
On 07/02/2006, at 11:36 AM, CONNER, BRENDAN (SBCSI) wrote:

> I finally got the JMSAppender working, and I can receive the logged
> message using a Message Driven Bean.  While working with my example, I
> noticed that the message that is received by the onMessage() method is
> an instance of ObjectMessage, which wraps an instance of LoggingEvent.
> My question is:
>
> How can I retrieve a formatted version of the logged message, as
> formatted by the layout given in my log4j.properties file?
>
> When I look at the string returned by LoggingEvent.getMessage(), it is
> just the string that was logged by the code, not the formatted string
> that should be the output of the Layout class.  Similarly, the string
> returned by LoggingEvent.getRenderedMessage() is also just the string
> that was logged by the code.
>
> Any help would be appreciated.  My log4j.properties file contains the
> following entries:
>
> log4j.category.com.ibm.example.pubsub=DEBUG, JmsAppender
>
> log4j.appender.JmsAppender=org.apache.log4j.net.JMSAppender
> log4j.appender.JmsAppender.topicConnectionFactoryBindingName=java:comp 
> /e
> nv/jms/PSExampleConnectionFactoryRef
> log4j.appender.JmsAppender.topicBindingName=java:comp/env/jms/ 
> PSExampleT
> opicRef
> log4j.appender.JmsAppender.layout=org.apache.log4j.PatternLayout
> log4j.appender.JmsAppender.layout.ConversionPattern=%d [%-5p] (%t) %c:
> %m%n
>
> - Brendan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


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


Mime
View raw message