[OJB-developers] Using Log4j
Brought to you by:
thma
From: <ber...@wa...> - 2001-11-21 16:12:02
|
Hi Thomas, Did you ever thought about using Log4j in your project. (http://jakarta.apache.org/log4j/docs/manual.html) Looking at the source I see quite often see things like catch (Exception e ) { System.err.println(e.) ..... } or if (debug) { System.err.println(xxx) } I've used log4j in some of my projets and it has the following advantages: You can have a better control on wat should be printed out with 4 levels of logging debug, info, warn, error You can use a configuration file (property file or xml) to change the level of logging so you don't need the setDebug and if (debug) You can use te same configuration file to tell the format of a line, for example adding a time stamp, the threat name,... My favorite is that you can control where message are going to, the console, a file, unix syslogd. The main disadvantage is that you are creating a dependency on a external package but it comes from the Jakarta project and is well supported. and of course that some code need to be changed, but most of it is repetitive; Add a static Category class member to some classes and replace the System.err with CAT.info or CAT.debug,.... Thank you for the great code you are writing Bertrand |