[bind10-dev] consider log4cplus for logging

Stephen Morris stephen at isc.org
Wed Apr 27 16:27:30 UTC 2011


On 27/04/2011 14:59, Jeremy C. Reed wrote:
> The README says:
> 
> Tested on the following platforms
> =================================
> 
> - Linux/AMD64 with GCC 4.1.2 and 4.3.2
> - FreeBSD/i386 and AMD64 with GCC 3.4.6, 4.2.1 and 4.3.3
> - Windows XP with MS Visual C++ 8.0, 9.0 and 10.0
> - OpenSolaris 5.11 with Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21,
>   with -library=stlport4

Given this and subsequent emails on this thread, it seems that log4cplus
does fit our needs.  If we are happy with the licence conditions, I
propose that in the next sprint we add a task to implement the logging
in terms of log4cplus.


On a related matter, I'm currently looking at task 745 (adding logging
to the NSAS), and I would like to propose a change to the message format
(and internals of the logging code):

Currently the message string is a "printf" format string, which is used
with the standard va_args mechanism to substitute a variable number of
parameters into the message (via vsnprintf).  However:

a) We are going to allow users to replace the message string at
run-time.  It occurs to me that if they replace a string and get the
type/number of substitution fields incorrect, it could lead to a crash
when a message is generated.

b) In a translation of a message into a foreign language, parameters may
need to appear in a different order from the English version.

For this reason, I suggest that instead of using "printf" format
strings, we use something like "{n}" in a message string to signify a
parameter (where 'n' is the position of the parameter in the argument
list - i.e. a message would look something like "unable to send query to
{1} due to {2}").  This would require a bit of extra work by the logging
code in handling the substitutions, but as a side-effect it should avoid
the problem outlined in (a) above.

Thoughts?

Stephen



More information about the bind10-dev mailing list