commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Sitze <>
Subject Re: [logging] API - methods for logging entry and exit events
Date Wed, 19 Jan 2005 16:07:29 GMT
Emmanuel Bourg <> wrote on 01/19/2005 06:16:35 AM:

> 9. Logging entry/exit event is not so common and I'd better write 
> log.debug("Entering" + param1 + ", " + param2 + ")");
> rather than
> log.enter(this, "foo", new Object[] { param1, param2 }, "Entering");
> enter()/exit() doesn't make the code much shorter, it provides just a 
> more detailed semantic.

1. But more than just an alternate to debug.  For loggers that "support" 
it, it would be mapped to a different logging level [i.e. JSR-47 "FINER"]. 
 If we were to follow the guidelines described in the current JCL users 
guide for "debug" level logging, and map those over to include the 
entry/exit method "level", then best practices for JCL would be:

a) log.debug() to be used as we cross component
               boundries, allowing a high-level
               view of the flow between multiple
               components.  Also reasonable to
               log "interesting" events/information
               that are meaningfull at a
               component level.

b) log.entry/exit() would be used as we cross
               class and method boundries,
               allowing a view of the flow
               between and within classes
               within a component.

c) log.trace() would be used to provide additional
               detail reflecting flow and information
               within a method.

And by having these on separate levels [for those impls
that support the levels], you could enable
(a), (a)+(b), or (a)+(b)+(c).

2. Just FYI, the [conceptual] equivalent to

    log.debug("Entering" + param1 + ", " + param2 + ")");

would be

    log.enter(this, "foo", new Object[] { param1, param2 }, null);


    Log.enter(Class clazz,
              String method,
              Object[] params,
              String additionalText)

is intended to be mapped to the logger, and it is expected that the logger 
impl would express that as something similar to:

    "Entering " + clazz.getName() + "." + methodName + "(" + params + ") " 
+ additionalText

[please consider that psuedo-code... there are details missing I know :-)]

> Emmanuel Bourg

Richard A. Sitze
IBM WebSphere WebServices Development

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