My life, and all that happens to it... I live in Hyderabad, India and work as a software development manager. An engineer from IIT, Kharagpur, I am married with two children, a 6 yr old daughter and a 1 yr old son.

Hyderabad, India

Blog Home

« April 2006 | Main | January 2006 »

Thursday, March 16, 2006

Java Logging with JDBC


I hate debuggers! Not that they don't solve the job they are meant for but I have always found them to be a big waste of time in the initial stages of debugging a code issue. I prefer to use a logger mechanism and then jump into the debugger for detailed runtime data only if I cannot track down the problem theoritically using my logs.

Anyway, I work in an environment where all development is done remotely and I don't have much control over the servers that actually run my code. I do have access to the database for the different environments and can create tables etc. I normally use Log4J for my logging needs but adding that manually to my development environment is a pain. So I finally turned to Java's logging API and found that it fell way below my Log4J based expectations. Firstly it did not give me much control over the logging configuration. Secondly, there was no JDBC based logging mechanism available. Well I decided to roll my own.

Features:
  • JDBC support for logging
  • Custom logging configuration (including the JDBC support configuration). Can be used for creating any custom configuration and not just the JDBC support.
  • Message caching. This implementation caches messages upto a configured threshold. All cached messages are logged to the database as soon as the threshold is reached.
  • Open source. Use, modify, distribute (as long as you retain the copyright notice below). Suggestions, bug reports welcome.
Pending Features (Stuff I would like to add but haven't yet):
  • Configurable Asynchronous logging: So that we don't block the main thread making the logging calls.
  • Performance Tunning: The current release is not optimized and has numerous areas which can benifit from some performance tunning.
I am releasing the source code to my JDBC support for Java's logging APIs. You can download the source code here. You may use this code for any purpose, as long as you leave the copyright notice attached. Use this code at your own risk.

See the readme.txt file in the zip archive for details of how to use the code. The JavaDoc is also a good place to look for further details. The source code is of course the best source for implementation and usage details.
-------------------------------------------------------------------------------
Copyright (C) 2006 Gautam Satpathy (gautam@satpathy.in)
You may use this code for any purpose, as long as you leave the
copyright notice attached. Use this code at your own risk.
-------------------------------------------------------------------------------

(Posted via Thinga Web)

Posted by Gautam Satpathy at 11:33 AM GMT+05:30
Edited on: Thursday, March 16, 2006 11:06 PM GMT+05:30
Categories: General, Software

|


Track referers to your site with referer.org free referrer feed.

Copyright © 2004 Gautam Satpathy.

March 2006
SunMonTueWedThuFriSat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Archives
Categories

Credits
Powered by
Thingamablog 1.0.5
Weblog Commenting and Trackback by HaloScan.com

 

For comments or questions about this website, please email the Webmaster
URI » http://www.satpathy.in Updated » Mon, Aug 7, 2006