public function activateOptions()
 {
     if (!isset($this->pattern)) {
         throw new Payone_Log4php_LoggerException("Mandatory parameter 'conversionPattern' is not set.");
     }
     $parser = new Payone_Log4php_LoggerPatternParser($this->pattern, $this->converterMap);
     $this->head = $parser->parse();
 }
Ejemplo n.º 2
0
 /**
  * Acquires a database connection based on parameters.
  * Parses the insert pattern to create a chain of converters which will be
  * used in forming query parameters from logging events.
  */
 public function activateOptions()
 {
     try {
         $this->establishConnection();
     } catch (PDOException $e) {
         $this->warn("Failed connecting to database: " . $e->getMessage());
         $this->close();
         return;
     }
     // Parse the insert patterns; pattern parts are comma delimited
     $pieces = explode(',', $this->insertPattern);
     $converterMap = Payone_Log4php_LoggerLayoutPattern::getDefaultConverterMap();
     foreach ($pieces as $pattern) {
         $parser = new Payone_Log4php_LoggerPatternParser($pattern, $converterMap);
         $this->converters[] = $parser->parse();
     }
     $this->closed = false;
 }