[bind10-dev] consider log4cplus for logging

Michal 'vorner' Vaner michal.vaner at nic.cz
Tue May 3 18:37:19 UTC 2011


Hello

On Tue, May 03, 2011 at 02:29:12PM +0100, Stephen Morris wrote:
> That is possible, but what does concern me is the cost of a logging call
> when no output is produced.  For example, if we have the call:
> 
> logger.debug(dbglevel, MSG_DEBUGMSG, expensive_function());

Yes, but that's problem of both proposals.

> although this gets unwieldy if there are a number of logging statements
> in the code.  We try to avoid macros - AFAIK, "isc_throw" is the only
> macro in the BIND 10 code - but is this a case where we should define
> some? For example:
> 
> #define LOG_DEBUG(LOGGER, DBGLEVEL, ID, ARG1) \
>     if ((LOGGER).isDebugEnabled()) { \
>         (LOGGER).debug((DBGLEVEL), (ID), (ARG1)); \
>     }

Yes, it seems that would be one such place. But we're still limited for one arg
there, which isn't nice. If we omitted the { } around the call and the
semicolon, we could use the thing with .arg calls. But then, strange things
could happen with else statement, unless we would do something really strange
like:

#define LOG_DEBUG(LOGGER, LEVEL, ID) \
  if (!(LOGGER).isDebugEnabled(LEVEL)) { \
    /* Here be nothing */ \
  } else { \
    (LOGGER).debug((LEVEL), (ID))

Then we could write it like
LOG_DEBUG(logger, 5, FANCY_FUNCTION).arg(5).arg("Hello");

With regards

-- 
2 keys should be enough for everyone

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20110503/a6decdec/attachment.bin>


More information about the bind10-dev mailing list