Return-Path: Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: (qmail 76868 invoked from network); 10 Jul 2006 21:04:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Jul 2006 21:04:45 -0000 Received: (qmail 91341 invoked by uid 500); 10 Jul 2006 21:04:43 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 91309 invoked by uid 500); 10 Jul 2006 21:04:43 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 91297 invoked by uid 99); 10 Jul 2006 21:04:43 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2006 14:04:43 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [12.11.148.122] (HELO relay2.ptc.com) (12.11.148.122) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2006 14:04:42 -0700 Received: from hq-ex3fe3.ptcnet.ptc.com ([132.253.201.67]) by relay2.ptc.com with ESMTP; 10 Jul 2006 17:04:20 -0400 X-IronPort-AV: i="4.06,225,1149480000"; d="scan'208,217"; a="145752522:sNHT25669648" Received: from [132.253.11.178] ([132.253.11.178]) by hq-ex3fe3.ptcnet.ptc.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 Jul 2006 17:04:21 -0400 Message-ID: <44B2C0D4.9070705@ptc.com> Date: Mon, 10 Jul 2006 16:04:20 -0500 From: Jess Holle User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Log4J Developers List Subject: Re: JMX package References: <2FB40470EBF3B949A838D34E06F12F3D2C5749@somme.ICSGLOBAL.local> <7.0.1.0.0.20060708143917.04b90b78@visi.com> <315BA7D5-65E8-42CF-BAC3-C1A970B8D61C@apache.org> <44B23C9B.5030403@ptc.com> In-Reply-To: <44B23C9B.5030403@ptc.com> Content-Type: multipart/alternative; boundary="------------020508080900090109030500" X-OriginalArrivalTime: 10 Jul 2006 21:04:21.0180 (UTC) FILETIME=[6A2F2FC0:01C6A464] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------020508080900090109030500 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jess Holle wrote: > Curt Arnold wrote: >> One things that seemed potentially interesting is to have a JMX >> appender that would allow log4j calls to generate JMX events. > That would seem to be trivial. > > My approach has been to do any/all JMX notification in prior to and/or > in parallel to logging. I do have JMX notification listeners that can > log the notification. > > To some degree, a log4j JMX notification appender seems like a > workaround for old code that really should be JMX instrumented and > doing notifications but which one does not own. [For one thing, > though log4j allows the message to be an Object, which is very good, > the Object generally will not be a JMX open type (e.g. CompositeData > or TabularData), which JMX notification user data really should be -- > and thus it is probable that data structure loss will occur when a > general message Object is sent in a notification via logging -- at > least prior to Java 6 where more open-type conversion is automated.] > On the other hand, unless dealing in open source or doing consulting > your customers don't have your code, don't necessarily have the skill > to do the changes in any case, and may see needs for such > notifications that you cannot see initially. For such cases, such an > appender seems like a very good thing. > > Dumb question along these lines: how does one reliably get the entire > MDC for a logging event, e.g. as a Map/Hashtable, from within an > appender? I can see how to do everything else easily enough, but > that's one little nit. I figured out the MDC stuff -- at least a reasonable if not foolproof approach -- and got everything working. I did the code on company time, so I can't share it, but I can say that it is only about 400 lines total including the extra verbosity of shoving everything possible into the notification's user data as CompositeData and plenty of comments. -- Jess Holle --------------020508080900090109030500 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Jess Holle wrote:
Curt Arnold wrote:
One things that seemed potentially interesting is to have a JMX appender that would allow log4j calls to generate JMX events.
That would seem to be trivial.

My approach has been to do any/all JMX notification in prior to and/or in parallel to logging.  I do have JMX notification listeners that can log the notification.

To some degree, a log4j JMX notification appender seems like a workaround for old code that really should be JMX instrumented and doing notifications but which one does not own.  [For one thing, though log4j allows the message to be an Object, which is very good, the Object generally will not be a JMX open type (e.g. CompositeData or TabularData), which JMX notification user data really should be -- and thus it is probable that data structure loss will occur when a general message Object is sent in a notification via logging -- at least prior to Java 6 where more open-type conversion is automated.]  On the other hand, unless dealing in open source or doing consulting your customers don't have your code, don't necessarily have the skill to do the changes in any case, and may see needs for such notifications that you cannot see initially.  For such cases, such an appender seems like a very good thing.

Dumb question along these lines: how does one reliably get the entire MDC for a logging event, e.g. as a Map/Hashtable, from within an appender?  I can see how to do everything else easily enough, but that's one little nit.
I figured out the MDC stuff -- at least a reasonable if not foolproof approach -- and got everything working.  I did the code on company time, so I can't share it, but I can say that it is only about 400 lines total including the extra verbosity of shoving everything possible into the notification's user data as CompositeData and plenty of comments.

--
Jess Holle


--------------020508080900090109030500--