|
What I'm trying to accomplish: I have always found it difficult to diagnose problems in multi-user, multi-threaded applications because the server log grow large and/or does not contain the needed information without me modifying the logging level and asking the user to reproduce the error, which may no longer be possible. I would like instead for the user to be able to submit an issue to support from within the application. This should send an email to support which contains all logging generated during his or her transaction. For example, suppose the user encounters a data integrity exception and submits it to support, I would like to see each SQL statement along with parameters, results (first row), execution time, and stack trace as well as any other debug logging produced during their transaction. The purpose of this information is to aid in supporting the application. How I envision implementing this: When a transaction begins, I instantiate an instance of TransactionLog, a simple class with two methods: append(String msg) and String getTransactionLog(). I pass this _object_ to every method in the back end. JDBC calls are made through a utility class which logs the SQL, parameters, first row of results, execution time, etc. The implementation specific exceptions are wrapped with in a custom exception (eg Data_base_Exception) which contains the TransactionLog attribute. This custom exception is returned to the client. When the user receives an exception message which they feel is unwarranted or requires clarification, regardless of the type of exception, they have the option of submitting this to support. This sends an email to support which contains precisely the information needed to diagnose what went wrong. It also provides a mechanism for users to report problems without the hassle of trying to get a hold of support during non-business hours. Finally my question... I have found this information incredibly more useful than hunting through a log on the server trying to figure out what happened. Is this a good idea? Is there a better way to do this?
|