From issues-return-10734-apmail-commons-issues-archive=commons.apache.org@commons.apache.org Tue Nov 17 21:14:04 2009 Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 4342 invoked from network); 17 Nov 2009 21:14:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Nov 2009 21:14:04 -0000 Received: (qmail 70076 invoked by uid 500); 17 Nov 2009 21:14:03 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 69960 invoked by uid 500); 17 Nov 2009 21:14:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 69881 invoked by uid 99); 17 Nov 2009 21:14:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Nov 2009 21:14:02 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Nov 2009 21:14:00 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id D8584234C1F0 for ; Tue, 17 Nov 2009 13:13:39 -0800 (PST) Message-ID: <1607973547.1258492419885.JavaMail.jira@brutus> Date: Tue, 17 Nov 2009 21:13:39 +0000 (UTC) From: "Christopher Schultz (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (DBCP-305) Use API-specific exception for logging abandoned objects In-Reply-To: <298538171.1258403799716.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DBCP-305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Christopher Schultz updated DBCP-305: ------------------------------------- Attachment: DBCP-305.diff Proposed patch to a) use an API-specific exception type and b) include the timestamp in the exception message The result is that logged exceptions are (hopefully) easier to locate and read in log files. I used a static inner class to simplify the patch, but you guys are free to split-apart the classes if you choose. > Use API-specific exception for logging abandoned objects > -------------------------------------------------------- > > Key: DBCP-305 > URL: https://issues.apache.org/jira/browse/DBCP-305 > Project: Commons Dbcp > Issue Type: Improvement > Reporter: Christopher Schultz > Priority: Trivial > Attachments: DBCP-305.diff > > > When a DBCP-managed object (Connection, Statement, etc.) is considered "abandoned", a stack trace is emitted to stdout. Unfortunately, the stack trace is for a simple java.lang.Exception (created in AbandonedTrace.init and AbandonedTrace.setStackTrace) with no message. > When scanning log files for exceptions, say, like this: > grep "Exception" my_logfile.log, I simply shows: > java.lang.Exception > java.lang.Exception > java.lang.Exception > ... > It would be nice to use a more descriptive exception (for instance, AbandonedObjectException) and/or add a descriptive message to the exception upon creation. > For example, it would be useful to execute the above command and see: > org.apache.commons.dbcp.AbandonedObjectException: DBCP object created 2009-11-05 10:15:00 by the following code was never closed > Having the timestamp and a definite identification of the exception (i.e. the class name) on the same line of log output is preferable IMO. > Implementation should be trivial; I'd be happy to submit a patch. Also, the format of the logging information isn't part of the API itself, so it shouldn't be a big deal to change it. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.