[bind10-dev] logging and exception

Shane Kerr shane at isc.org
Thu Jun 23 12:30:46 UTC 2011


Michal,

Speaking from ignorance here...

On Thu, 2011-06-23 at 08:33 +0200, Michal 'vorner' Vaner wrote:
> > 2. Similar to #1, but simply catch any exception from the logger and
> >    ignore it:
> > #define LOG_DEBUG(LOGGER, LEVEL, MESSAGE) \
> >     if (!(LOGGER).isDebugEnabled((LEVEL))) { \
> >     } else { \
> >         try { \
> >           (LOGGER).debug((LEVEL), (MESSAGE)); } \
> >     } catch (...) {}
> >    I don't like this either, but in this context it may be a least
> >    evil and acceptable option.
> 
> This, again, would be problematic, because of how the .arg is done. They would
> be out of the call. We can catch exceptions inside of them, when replacing the
> string, but the conversion is hard to cover.

If the only exception we are concerned with is allocation, then is it
really that tricky to catch bad_alloc and ignore it in the arg() call?

--
Shane




More information about the bind10-dev mailing list