commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Schultz (JIRA)" <>
Subject [jira] Commented: (DBCP-305) Use API-specific exception for logging abandoned objects
Date Tue, 17 Nov 2009 20:28:39 GMT


Christopher Schultz commented on DBCP-305:

I'm happy to provide a patch to AbandonedTrace, but it is marked as deprecated in the javadoc
and I want to make sure I'm doing the right thing. There's an svn comment from markt stating
that the "problem" has been fixed and so AbandonedTrace need not be deprecated, so I guess
that means AbandonedTrace is still the way to do, eh?

> Use API-specific exception for logging abandoned objects
> --------------------------------------------------------
>                 Key: DBCP-305
>                 URL:
>             Project: Commons Dbcp
>          Issue Type: Improvement
>            Reporter: Christopher Schultz
>            Priority: Trivial
> 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

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message