Kea 2.7.6
|
Kea logging uses the concepts of the widely-used Java logging package log4j (https://logging.apache.org/log4j/), albeit implemented in C++ using an open-source port. Features of the system are:
Within Kea, the root logger root logger is given the name of the program (via the stand-alone function setRootLoggerName()). Other loggers are children of the root logger and are named "<program>.<sublogger>". This name appears in logging output, allowing users to identify both the Kea program and the component within the program that generated the message.
When creating a logger, the abbreviated name "<sublogger>" can be used; the program name will be prepended to it when the logger is created. In this way, individual libraries can have their own loggers without worrying about the program in which they are used, but:
Instead of embedding the text of messages within the code, each message is referred to using a symbolic name. The logging code uses this name as a key in a dictionary from which the message text is obtained. Such a system allows for the optional replacement of message text at run time. More details about the message dictionary (and the compiler used to create the symbol definitions) can be found in other modules in the src/lib/log directory.
Owing to the way that the logging is implemented, notably that loggers can be declared as static external objects, there is a restriction on the length of the name of a logger component (i.e. the length of the string passed to the Logger constructor) to a maximum of 31 characters. There is no reason for this particular value other than limiting the amount of memory used. It is defined by the constant Logger::MAX_LOGGER_NAME_SIZE, and can be made larger (or smaller) if so desired.