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 01:11:55 GMT
the layout in your log4j.properties is irrelevant to JMSAppender,  
since it is sending the serialized version of the LoggingEvent.

In short, your MDB won't know what the layout is unless you tell it  
because that information is not sent along the wire during the JMS  
communication.

Paul


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

> Right, we want to use JMSAppender to store our message in the DB.  But
> we may want to store the formatted version of the message in our
> database.  However, are you saying that the JMSAppender does not  
> handle
> calling Layout itself?  So does our MDB have to have access to our
> log4j.properties file and read it manually?  I'm hoping I'm missing
> something here.... ;-)
>
> - Brendan
>
> -----Original Message-----
> From: Paul Smith [mailto:psmith@aconex.com]
> Sent: Monday, February 06, 2006 6:40 PM
> To: Log4J Users List
> Subject: Re: Using Layouts with JMSAppender
>
>
> 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:com 
>> p
>
>> /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
>
>
> ---------------------------------------------------------------------
> 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