Wow! The list was boring there for a few days -- that's over :-) How exciting.
Anyway, I wrote a quick and dirty JDBC appender for work. We also had a buffer that filled with logging requests and when it reached a certain threshold, it would do a batch update to the database from a separate thread. We didn't have to worry about it being used in an EJB container, so it was really a good idea. It is my understanding that batch updates are faster/more efficient than executing a lot of single requests. Especially if those requests are not prepared statements or callable statements! Other problems I faced: 1) The user logs into the application. If logging statements prior to this point are made and should go to the database - what username password do they use? The appender needs to have that info separate from the app. 2) If we reach the end of the program and we use a buffer - how do we put those statements into the database? Explicit call - no. Had to use a finalize method. That may be an instance of when it is appropriate to use a finalize - but only if the appender forms a separate connection to the database. Along with the ideas regarding inheritance vs. composition -> it might be a good idea to create a "strategy" for doing the updates to the database. You could have a BatchUpdate, CallableUpdate, PreparedUpdate, etc. These different classes would use different strategies for running the update. Some applications may have a limit on database connections and don't want to have a whole db connection used up by the logging subsystem whereas others are more concerned about speed via batch updates and still others would be concerned about using a stored proc so they could do other things with the data on the database side....and so forth. Richard