Package ipapython :: Module ipa_log_manager :: Class IPALogManager
[hide private]
[frames] | no frames]

Class IPALogManager

source code

            object --+    
                     |    
log_manager.LogManager --+
                         |
                        IPALogManager

Subclass the LogManager to enforce some IPA specfic logging conventions.

Instance Methods [hide private]
 
__init__(self, configure_state=None)
Create a new LogManager instance using root_logger_name as the parent of all loggers maintained by the manager.
source code
 
configure_from_env(self, env, configure_state=None)
Read the loggger configuration from the Env config.
source code
 
create_log_handlers(self, configs, logger=None, configure_state=None)
Enforce some IPA specific configurations
source code

Inherited from log_manager.LogManager: __str__, apply_configuration, configure, get_configured_logger_level, get_handler, get_logger, get_logger_handlers, get_loggers_with_handler, get_minimum_handler_level_for_logger, remove_handler, set_default_level, set_handler_level

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  log_logger_level_config_re = re.compile(r'^log_logger_level_(d...
Properties [hide private]

Inherited from log_manager.LogManager: default_level

Inherited from object: __class__

Method Details [hide private]

__init__(self, configure_state=None)
(Constructor)

source code 

Create a new LogManager instance using root_logger_name as the parent of all loggers maintained by the manager.

Only one log manger should be created for each logging namespace.

Parameters:
  • configure_state - Used by clients of the log manager to track the configuration state, may be any object.
Returns:
LogManager instance
Overrides: object.__init__

configure_from_env(self, env, configure_state=None)

source code 

Read the loggger configuration from the Env config. The following items may be configured:

Logger Levels

log_logger_XXX = comma separated list of regexps

Logger levels can be explicitly specified for specific loggers as opposed to a global logging level. Specific loggers are indiciated by a list of regular expressions bound to a level. If a logger's name matches the regexp then it is assigned that level. The keys in the Env config must begin with "log_logger_level_" and then be followed by a symbolic or numeric log level, for example:

log_logger_level_debug = ipalib\.dn\..*
log_logger_level_35 = ipalib\.plugins\.dogtag

The first line says any logger belonging to the ipalib.dn module will have it's level configured to debug.

The second line say the ipa.plugins.dogtag logger will be configured to level 35.

Note: logger names are a dot ('.') separated list forming a path in the logger tree. The dot character is also a regular expression metacharacter (matches any character) therefore you will usually need to escape the dot in the logger names by preceeding it with a backslash.

The return value of this function is a dict with the following format:

logger_regexps
List of (regexp, level) tuples
Parameters:
  • env - Env object configuration values are read from.
  • configure_state - If other than None update the log manger's configure_state variable to this object. Clients of the log manager can use configure_state to track the state of the log manager.

create_log_handlers(self, configs, logger=None, configure_state=None)

source code 
Enforce some IPA specific configurations
Parameters:
  • configs - Sequence of dicts (any iterable yielding a dict). Each dict creates one handler and contains the configuration parameters used to create that handler.
  • logger - If unspecified the handlers will be attached to the LogManager.root_logger, otherwise the handlers will be attached to the specified logger.
  • configure_state - If other than None update the log manger's configure_state variable to this object. Clients of the log manager can use configure_state to track the state of the log manager.
Returns:
The list of created handers.
Overrides: log_manager.LogManager.create_log_handlers

Class Variable Details [hide private]

log_logger_level_config_re

Value:
re.compile(r'^log_logger_level_(debug|info|warn|warning|error|critical\
|\d+)$')