Re: [OJB-developers] Using Log4j
Brought to you by:
thma
From: Leandro R. S. C. <le...@ib...> - 2001-11-21 19:44:35
|
On Wed, 2001-11-21 at 14:10, ber...@wa... wrote: > Hi Thomas, Hello, I new to this list and OJB > > 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: I've used it too and it's a wonderfull tool ! > > 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. We could wrap Log4J inside OJB to minimize coupling between both projects > > 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 There is another tool that I think is very promissing AspectJ (see http://aspectj.org). We can used it as a logger mechanism and other things too ! -- Leandro Rodrigo Saad Cruz IT - Inter Business Tecnologia e Servicos (IB) |