Пример #1
0
 /**
  * Configures log4php by defining a configuration file and/or class.
  * 
  * This method needs to be called before the first logging event has 
  * occured. If this method is not called before then, the standard 
  * configuration takes place (@see Ideasa_Log4php_Configurators_LoggerConfiguratorBasic).
  * 
  * If only the configuration file is given, the configurator class will
  * be determined by the config file extension.  
  * 
  * If a custom configurator class is provided, the configuration file
  * should either be null or contain the path to file used by the custom 
  * configurator. Make sure the configurator class is already loaded, or
  * that it can be included by PHP when necessary.
  * 
  * @param string $configurationFile path to the configuration file
  * @param string $configurationClass name of the custom configurator class 
  */
 public static function configure($configurationFile = null, $configurationClass = null)
 {
     if ($configurationClass === null && $configurationFile === null) {
         self::$configurationClass = 'Ideasa_Log4php_Configurators_LoggerConfiguratorBasic';
         return;
     }
     if ($configurationClass !== null) {
         self::$configurationFile = $configurationFile;
         self::$configurationClass = $configurationClass;
         return;
     }
     if (strtolower(substr($configurationFile, -4)) == '.xml') {
         self::$configurationFile = $configurationFile;
         self::$configurationClass = 'Ideasa_Log4php_Configurators_LoggerConfiguratorXml';
     } else {
         self::$configurationFile = $configurationFile;
         self::$configurationClass = 'Ideasa_Log4php_Configurators_LoggerConfiguratorIni';
     }
 }