Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 17968 invoked from network); 7 Feb 2006 01:12:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Feb 2006 01:12:33 -0000 Received: (qmail 25398 invoked by uid 500); 7 Feb 2006 01:12:21 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 25342 invoked by uid 500); 7 Feb 2006 01:12:20 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 25331 invoked by uid 99); 7 Feb 2006 01:12:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Feb 2006 17:12:20 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [203.89.192.138] (HELO mail.app.aconex.com) (203.89.192.138) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Feb 2006 17:12:19 -0800 Received: from page.mel.office.aconex.com (page.mel.office.aconex.com [192.168.0.210]) by mail.app.aconex.com (Postfix) with ESMTP id 826735B8071 for ; Tue, 7 Feb 2006 12:11:58 +1100 (EST) Received: from localhost (page.mel.aconex.com [127.0.0.1]) by page.mel.office.aconex.com (Postfix) with ESMTP id 641255340F1 for ; Tue, 7 Feb 2006 12:11:58 +1100 (EST) Received: from page.mel.office.aconex.com ([127.0.0.1]) by localhost (mail.aconex.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20504-01-54 for ; Tue, 7 Feb 2006 12:11:57 +1100 (EST) Received: from [192.168.0.242] (unknown [192.168.0.242]) by page.mel.office.aconex.com (Postfix) with ESMTP id F1215534039 for ; Tue, 7 Feb 2006 12:11:56 +1100 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <67538F65C12991418BE2801290008A070230F1AE@ilnort1msgusr15.ITServices.sbc.com> References: <67538F65C12991418BE2801290008A070230F1AE@ilnort1msgusr15.ITServices.sbc.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Paul Smith Subject: Re: Using Layouts with JMSAppender Date: Tue, 7 Feb 2006 12:11:55 +1100 To: "Log4J Users List" X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: amavisd-new at aconex.com X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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