Class LoggerConfiguratorDefault

Description

Implements interfaces:

Default implementation of the logger configurator.

Configures log4php based on a provided configuration file or array.

Located in /configurators/LoggerConfiguratorDefault.php (line 31)


	
			
Class Constant Summary
 FORMAT_INI = 'ini'
 FORMAT_PHP = 'php'
 FORMAT_XML = 'xml'
Variable Summary
static mixed $defaultConfiguration
mixed $adapters
mixed $appenders
Method Summary
static array getDefaultConfiguration ()
void configure (LoggerHierarchy $hierarchy, [string|array $input = null])
void configureAppender (string $name, array $config)
void configureLogger (Logger $logger, array $config)
void configureOtherLogger (LoggerHierarchy $hierarchy,  $name,  $config)
void configureRenderer (LoggerHierarchy $hierarchy,  $config)
void configureRootLogger (LoggerHierarchy $hierarchy,  $config)
void createAppenderFilter (LoggerAppender $appender, array $config)
void createAppenderLayout (LoggerAppender $appender, array $config)
void doConfigure (LoggerHierarchy $hierarchy, array $config)
void getConfigType ( $url)
array parse (string|array $input)
The parseFile (string $url)
void setOptions (mixed $object, unknown_type $options)
void warn ( $message)
Variables
static mixed $defaultConfiguration = array(
'threshold' => 'ALL',
'rootLogger' => array(
'level' => 'DEBUG',
'appenders' => array('default'),),'appenders'=>array('default'=>array('class'=>'LoggerAppenderEcho','layout'=>array('class'=>'LoggerLayoutTTCC',),),),)
(line 50)

Default configuration; used if no configuration file is provided.

  • access: private
mixed $adapters = array(
self::FORMAT_XML => 'LoggerConfigurationAdapterXML',
self::FORMAT_INI => 'LoggerConfigurationAdapterINI',
self::FORMAT_PHP => 'LoggerConfigurationAdapterPHP',
)
(line 43)

Defines which adapter should be used for parsing which format.

  • access: private
mixed $appenders = array() (line 67)

Holds the appenders before they are linked to loggers.

  • access: private
Methods
static getDefaultConfiguration (line 138)

Returns the default log4php configuration.

  • access: public
static array getDefaultConfiguration ()
configure (line 85)

Configures log4php based on the given configuration. The input can either be a path to the config file, or a PHP array holding the configuration.

If no configuration is given, or if the given configuration cannot be parsed for whatever reason, a warning will be issued, and log4php will use the default configuration contained in $defaultConfiguration.

  • access: public
void configure (LoggerHierarchy $hierarchy, [string|array $input = null])
  • LoggerHierarchy $hierarchy: The hierarchy on which to perform the configuration.
  • string|array $input: Either path to the config file or the configuration as an array. If not set, default configuration will be used.

Implementation of:
LoggerConfigurator::configure()
Configures log4php based on the given configuration.
configureAppender (line 267)

Configures an appender based on given config and saves it to $appenders array so it can be later linked to loggers.

  • access: private
void configureAppender (string $name, array $config)
  • string $name: Appender name.
  • array $config: Appender configuration options.
configureLogger (line 410)

Configures a logger.

  • access: private
void configureLogger (Logger $logger, array $config)
  • Logger $logger: The logger to configure
  • array $config: Logger configuration options.
configureOtherLogger (line 398)

Configures a logger which is not root.

void configureOtherLogger (LoggerHierarchy $hierarchy,  $name,  $config)
configureRenderer (line 229)
  • access: private
void configureRenderer (LoggerHierarchy $hierarchy,  $config)
configureRootLogger (line 389)

Configures the root logger

void configureRootLogger (LoggerHierarchy $hierarchy,  $config)
createAppenderFilter (line 363)

Parses filter config, creates the filter and adds it to the appender's filter chain.

  • access: private
void createAppenderFilter (LoggerAppender $appender, array $config)
createAppenderLayout (line 331)

Parses layout config, creates the layout and links it to the appender.

  • access: private
void createAppenderLayout (LoggerAppender $appender, array $config)
doConfigure (line 192)

Constructs the logger hierarchy based on configuration.

  • access: private
void doConfigure (LoggerHierarchy $hierarchy, array $config)
getConfigType (line 166)

Determines configuration file type based on the file extension.

  • access: private
void getConfigType ( $url)
  • $url
parse (line 103)

Parses the given configuration and returns the parsed configuration as a PHP array. Does not perform any configuration.

If no configuration is given, or if the given configuration cannot be parsed for whatever reason, a warning will be issued, and the default configuration will be returned ($defaultConfiguration).

  • return: The parsed configuration.
  • access: public
array parse (string|array $input)
  • string|array $input: Either path to the config file or the configuration as an array. If not set, default configuration will be used.
parseFile (line 152)

Loads the configuration file from the given URL, determines which adapter to use, converts the configuration to a PHP array and returns it.

  • return: configuration from the config file, as a PHP array.
  • throws: LoggerException If the configuration file cannot be loaded, or if the parsing fails.
  • access: private
The parseFile (string $url)
  • string $url: Path to the config file.
setOptions (line 469)

Helper method which applies given options to an object which has setters for these options (such as appenders, layouts, etc.).

For example, if options are:

  1.  array(
  2.      'file' => '/tmp/myfile.log',
  3.      'append' => true
  4.  )

This method will call:

  1.  $object->setFile('/tmp/myfile.log')
  2.  $object->setAppend(true)

If required setters do not exist, it will produce a warning.

  • access: private
void setOptions (mixed $object, unknown_type $options)
  • mixed $object: The object to configure.
  • unknown_type $options
warn (line 482)

Helper method to simplify error reporting.

  • access: private
void warn ( $message)
  • $message
Class Constants
FORMAT_INI = 'ini' (line 40)

INI (properties) configuration file format.

FORMAT_PHP = 'php' (line 37)

PHP configuration file format.

FORMAT_XML = 'xml' (line 34)

XML configuration file format.

Documentation generated on Sat, 18 Feb 2012 22:32:24 +0000 by phpDocumentor 1.4.3