commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsi...@us.ibm.com
Subject Re: [logging] adding enter() and exit()
Date Mon, 15 Jul 2002 14:47:51 GMT
-1 as-is

As costin points out, you change our current pattern by introducing Object
and Object[] params.

I'm +1 to adding
      entry(String message)
      exit(String message)

only, but your API begs for more implementation in the wrapper.  While it's
fine for 'pass-through' to API's that support these directly, for "other"
API's we would have to determine the calling function, handle the
parameters, etc.

*******************************************
Richard A. Sitze            rsitze@us.ibm.com
CORBA Interoperability & WebServices
IBM WebSphere Development


-0 - you can just debug() or trace().

There are tons of features that could be added, and each may
be very usefull, but for now I think we should keep it minimal.

One interesting thing here is the idea of passing Object[] or
some other complex types. The API allows that ( the argument
is an Object), but so far no implementation except log4j
can take advantage of that.

Costin

On Sun, 14 Jul 2002, Jeff Dever wrote:

> Reposting, as it did not generate any comments last time.
>
>
> Jeff Dever wrote:
>
> > What do you think about enter() and exit() methods to the Log
> > interface.  These would be used for fined grained trace logging of
> > method entry and exit points:
> >
> > public interface Log
> > {
> >    public void enter(Object[] params);
> >    pubilc void enter(Object param);
> >    public void enter();
> >    public void exit(Object returnValue);
> >    public void exit()
> > }
> >
> > An example of using these new logging methods:
> >
> > public class SomeClass
> > {
> >    static Log = LogFactory.getLog(className);
> >
> >    public void method1()
> >    {
> >        logger.enter();
> >        //... do stuff
> >        logger.exit();
> >    }
> >
> >    public Object method2(Object param1, Object param2)
> >    {
> >        logger.enter(new Object[]{param1, param2});
> >        Object returnValue = null;
> >        //... do stuff
> >        logger.exit(returnValue);
> >        return returnValue;
> >    }
> > }
> >
> > There should be little problem implementing this functionality in the
> > logging.impl wrappers.  Some of them already support this functionality
> > directly (log4j, jdk1.4) which is part of the motivation for this
> > suggestion.  For example, implementing the methods in the Jdk14logger
> > could be as simple as:
> >
> > public class Jdk14logger implements Log
> > {
> >    public void enter(Object[] params)
> >    {
> >       //use similar introspection technique to find className and
> > methodName
> >       //as log() already does
> >       logger.enter(className, methodName, params)
> >    }
> >
> >    // and so on for the other enter() and exit() functions
> > }
> >
> > I beleive that this would add quite a bit of utility to those wishing
to
> > use commons-logging that like to use entry and exit trace calls.  At
the
> > same time it maintains backwards compatibility with the existing
> > interface and does not add any extra overhead for those not using the
> > enter/exit logging methods.
> >
> > --
> > To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.
apache.org>
> > For additional commands, e-mail: <mailto:commons-dev-help@jakarta.
apache.org>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.
org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.
org>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.
org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.
org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message