logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CONNER, BRENDAN \(SBCSI\)" <bc1...@att.com>
Subject Using Layouts with JMSAppender
Date Tue, 07 Feb 2006 00:36:15 GMT
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


Mime
View raw message