Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It holds a reference to a LoggingStatistics instance, but it does not use it directly, this is to be used by child classes to calculate statistics about the logging calls. A recommendation is to move this reference out of the BaseLog class to the Logger class, because the BaseLog class is also inherited by the Handler class and their instances don't require the LoggingStatistics reference.

LoggingStatistics

The LoggingStatistics class is utility class for calculating and storing statistics about the logs that have been processed by a specific logger. There are some configurable parameters:

...

  • messageStatistics: Number of log messages per granularity unit.
  • errorStatistics: Number of log errors per granularity unit.
  • messageIncrement: Number of log messages since last calculation.
  • errorIncrement: Number of log errors since last calculation.
  • actualStatisticsPeriod: Actual period of time which was used to gather data before calculating statistics.
    • Usually close to statisticsCalculationPeriod
    • May be different when there's a change of configuration or during the destruction of the logger

Logger

LogTrace

Logger_ptr

StopWatch

Loggable

GenericLogger

ACSLogger

Handler

StdoutHandler

LogSvcHandler

...

This is the main class in the logging system, which is eventually exposes its interface to other components:

  • addHandler: Adding multiple handlers for the log messages
  • removeHandler: Remove a registered handler
  • setLevels: Setting the log level priority for remote and local handling
  • log: Delegates the logging task to each of its logging handlers
    • Handles interaction with loggingStatistics instance (stats) as well
  • Other getter and setter methods

Additionally, it handles three singleton loggers (global, anonymous, static). The anonymous and static loggers are initialized the first time they're used as child of the global logger. The global logger is created the first time it's used.

Logger_ptr

Logger_ptr is a sub-class from Logger class, which is used as a singleton to store references to global, anonymous, static and a set of named loggers. This is only used from the Logger class.

LogTrace

A convenience class that logs when its constructor and destructor are called, including the time taken between the two calls.

StopWatch

A convenience class that logs when its constructor and destructor are called. It monitors the time taken between the two calls and reports if the configured limit time is exceeded.

Loggable

A small utility class that enables class logging by providing a simple getLogger() method. The logger to be used is either the global logger or a named logger obtained when the constructor is executed.

GenericLogger

A logger that is initialized with an StdoutHandler. It offers the getLogger method returning named loggers as GenericLogger instances.

ACSLogger

A logger that is initialized with the LogSvcHandler. It offers the getLogger method returning named loggers as ACSLogger instances.

Additionally it offers mutex acquire/release methods for convenience.

Handler

The Handler base class defines a set of common methods that all handlers should have:

  • setLevels: Set the remote and local levels for handlers if they're matched with the given type (Implementation specific). By default handlers set the general level (to the given remote level) and ignore the local and type parameters as well as avoid interacting with the remoteLevel and localLevel methods and variables.
  • (get|set)Level: Interact with the general log level for the handler.
  • (get|set)RemoteLevel/(get|set)LocalLevel: Interact with the remote or local level for the handler.
  • (get|set)RemoteLevelType/(get|set)LocalLevelType: Interact with the remote or local level type for the handler.

StdoutHandler

Extends the handler functionality by adding a method to get the name of the handler (Hard-coded to "Stdout").

Provides a basic log method implementation to print to the stdout with printf. It adds the support for setting the log level through the ACS_LOG_STDOUT variable.

LogSvcHandler

Extends the handler functionality by adding a method to get the name of the handler (Hard-coded to "acsLogSvc").

The LogSvcHandler is the first part of the logging system to relate with ACE Logger. It offers two convenience functions:

  • ace2acsPriority/acs2acePriority: To convert between ACE and ACS log levels (priority)

Overrides the setLevels implementation by considering local/remote levels and the log level type. It defines the following log level types:

  • DYNAMIC_LOG_LEVEL (1)
  • CDB_REFRESH_LOG_LEVEL (2)
  • ENV_LOG_LEVEL (3)
  • CDB_LOG_LEVEL (4)
  • DEFAULT_LOG_LEVEL (5)
  • NOT_DEFINED_LOG_LEVEL (6)

Using these log level types, it sets the log levels if the handler log level type is greater or equal than the given type.

It adds the support for setting the local log level through the ACS_LOG_STDOUT variable and to the remote log level through ACS_LOG_CENTRAL variable.

It makes an implementation of the log method based on the LoggingProxy and the ACE_Log_Msg classes to interact with the local (stdout) and remote (logging service) endpoints.

ACE_Log_Msg

The ACE_Log_Msg is part of the ACE Logging implementation in ACE middle-ware. It's purpose is to delegate a log call to a callback instance of the ACE_Log_Msg_Callback class. The LoggingProxy is an extension of this class.

The main purpose of the ACE_Log_Msg class is to allow formatted error messages to be printed in a thread-safe manner to various locations, such as stderr, cerr, a distributed logger, etc.

LoggingProxy

LogLevelDefinition

...