Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 61011 invoked from network); 31 Aug 2004 02:11:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 31 Aug 2004 02:11:01 -0000 Received: (qmail 33693 invoked by uid 500); 31 Aug 2004 02:10:48 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 33558 invoked by uid 500); 31 Aug 2004 02:10:42 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 33412 invoked by uid 99); 31 Aug 2004 02:10:38 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [202.135.116.201] (HELO unxcoms01.ecnetwork.co.nz) (202.135.116.201) by apache.org (qpsmtpd/0.27.1) with ESMTP; Mon, 30 Aug 2004 19:10:34 -0700 Received: from serpent.ecnetwork.co.nz (serpent [202.135.190.10]) by unxcoms01.ecnetwork.co.nz (8.12.8/8.12.8) with ESMTP id i7V2ALc1019416 for ; Tue, 31 Aug 2004 14:10:21 +1200 Received: from [202.135.190.30] (unknown [202.135.190.30]) by serpent.ecnetwork.co.nz (Postfix) with ESMTP id 6B8711035 for ; Tue, 31 Aug 2004 14:11:54 +1200 (NZST) Subject: Re: [general] logging From: Simon Kitching To: Jakarta Commons Developers List In-Reply-To: References: Content-Type: text/plain Message-Id: <1093918205.25613.37.camel@pcsimon> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 31 Aug 2004 14:10:05 +1200 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Tue, 2004-08-31 at 13:27, Henri Yandell wrote: > On Thu, 26 Aug 2004, Craig McClanahan wrote: > > > You are asking two separate but related quesitons here, so they should > > be addressed separately. > > > > (1) Should libraries depend on *any* logging library? > > > > It seems obvious to me that libraries would benefit from having > > logging embedded. It's not just for the library developers to debug; > > it is also for the library *user*. Digester is actually a classic > > example of this use case ... debugging your matching rules is MUCH > > easier when you can turn on trace level debugging to see which rules > > are actually getting matched, and what order the rules are being fired > > in. > > Just to bring up another thought on this question, what happens in other > languages/techs? > > Does glibc contain lots of debug statements (I assume to syslog?). Does > Swing contain lots of debug statements? Do libraries contain their own > plugins to the -w flag in Perl? (Might do for all I know). Well, the sshd application contains logs of debug statements to syslog, and these can be absolutely vital in tracking down login problems. The DB2 database has diagnostic logs that can be tuned to generate various amounts of data. Actually, the diagnostic output is next to useless, but the principle is there. I would guess that J2EE app servers have diagnostic output available (others may be able to give details). > > I'll happily agree that debugging statements in code is very useful > (despite the arguments of the IDE debuggers), but I'm unconvinced that > released stable binaries should contain the debugging etc. It seems > unlikely to be of a lot of use to direct users, and definitely of less use > for third-hand users (think developers of Struts trying to navigate > through Digester debugging statements). I vigorously disagree with this statement. The ability to turn on logging in an application which is deployed in production is extremely important. You can't always duplicate problems in test enviroments (particularly when the problem is occurring at a customer site). And you certainly can't run code in a production environment under debugger control. And going through the paperwork to deploy specially-compiled versions of apps with debugging enabled can be a *major* hassle. Of course enabling logging does have a performance impact (which is why it is important that the logging system have the ability to carefully select subsets of messages relevant to the problem), but it is much easier to get agreement to tweak such settings than to deploy new executables. If the logging can be reconfigured without restarting the application concerned, that is even better. As a developer of software deployed in large commercial sites, I *love* the ability to leave logging statements in production code, and enable/disable them as required. In your example of Struts users, yes they *can* understand what the digester log statements mean. And if they can't, they can post such logs to the appropriate email list and get advice on what the problem is. When library functions are so simple that their return codes or exception objects *completely* describe the problem which occured, then logging within the library may not be necessary because the calling code has all the necessary info to generate good error messages to the user (potentially via logging). This description may well apply to the majority of glibc functions. And may well apply to most of o.a.c.lang or o.a.c.collections. But this description does *not* fit well with many other commons libraries, digester being a prime example. Digester has loads of "state", so the true cause of a problem may be related to a method call well-removed from the point at which the error occurred. And logging is a very good way to track these issues down. I expect that "configuration" has similar issues, and maybe other commons libraries. Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org