Loggers and AppendersLogging system has two components: loggers and appenders. These types of components enable users to log messages according to message type and level andcontrol at runtime where they are reported. LoggersThe first and foremost advantage of this system resided in the ability to disable certain log statements while allowing others to print unhindered. This capability assumes that the loggers are categorized according to some developer-chosen criteria. Loggers are named entitites. Logger names are case-sensitive and they follow the hierarchical naming rule: A Logger is said to be an ancestor of another logger if its name followed by a dot is a prefix of the descendant logger name. A logger is said to be a parent of a child logger if there are no ancestors between itself and the descendant logger. For example, the logger named "entities.player" is a parent of the logger named "entities.player.character". Similarly, "entities" is a parent of "entities.player" and an ancestor of "entities.player.character". Loggers may be assigned levels. The set of possible levels are TRACE, DEBUG, INFO, WARN, ERROR AND FATAL, or be disabled using level DISABLED. By definition the printing method determines the level of a logging request. For example, TC_LOG_INFO(...) is a logging request of level INFO. A logging request is said to be enabled if its level is higher than or equal to the level of its logger. Otherwise, the request is said to be disabled. A logger without an assigned level will inherit one from the hierarchy. Example Logger Name | Assigned Level | Inherited Level |
---|
root | Proot | Proot | server | None | Proot |
As "server" is not defined, it uses the root logger and it's log level. TRACE < DEBUG < INFO < WARN < ERROR < FATAL. |