public function __construct() { parent::__construct(); $log = new LoggerFactory(); $this->logger = $log->create('GermaniaSacra', 'TYPO3\\Flow\\Log\\Logger', '\\TYPO3\\Flow\\Log\\Backend\\ConsoleBackend'); }
public function initializeAction() { $this->configuration = ['endpoint' => ['localhost' => ['host' => $this->settings['solr']['host'], 'port' => $this->settings['solr']['port'], 'path' => $this->settings['solr']['path'], 'core' => $this->settings['solr']['core'], 'timeout' => $this->settings['solr']['timeout']]]]; if (!$this->logger) { $log = new LoggerFactory(); $this->logger = $log->create('GermaniaSacra', 'TYPO3\\Flow\\Log\\Logger', '\\TYPO3\\Flow\\Log\\Backend\\FileBackend', ['logFileUrl' => FLOW_PATH_DATA . 'Logs/GermaniaSacra/Mysql2Solr.log', 'createParentDirectories' => true]); } $this->client = new \Solarium\Client($this->configuration); $this->client->setAdapter('Solarium\\Core\\Client\\Adapter\\Curl'); $personenFile = FLOW_PATH_DATA . 'Persistent/GermaniaSacra/personen.json'; $http = new \Guzzle\Http\Client(); try { $personenData = $http->get(self::PERSONEN_URL)->send()->getBody(); file_put_contents($personenFile, $personenData); } catch (\Exception $e) { $this->logger->logException($e); } $this->personen = json_decode(file_get_contents($personenFile), true); $this->dataImport = new \Subugoe\GermaniaSacra\Controller\DataImportController(); }
/** * Initializes the System Logger * * @param Bootstrap $bootstrap * @return void */ public static function initializeSystemLogger(Bootstrap $bootstrap) { $configurationManager = $bootstrap->getEarlyInstance('TYPO3\\Flow\\Configuration\\ConfigurationManager'); $settings = $configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow'); if (!isset($settings['log']['systemLogger']['logger'])) { $settings['log']['systemLogger']['logger'] = 'TYPO3\\Flow\\Log\\Logger'; } $systemLogger = \TYPO3\Flow\Log\LoggerFactory::create('SystemLogger', $settings['log']['systemLogger']['logger'], $settings['log']['systemLogger']['backend'], $settings['log']['systemLogger']['backendOptions']); $bootstrap->setEarlyInstance('TYPO3\\Flow\\Log\\SystemLoggerInterface', $systemLogger); $packageManager = $bootstrap->getEarlyInstance('TYPO3\\Flow\\Package\\PackageManagerInterface'); $packageManager->injectSystemLogger($systemLogger); }
/** * Creates a log file * @param string $logFile The name of the log file */ public function initializeLogger($logFile) { $log = new LoggerFactory(); if (file_exists($this->logDirectory . $logFile)) { unlink($this->logDirectory . $logFile); } $this->importExportLogger = $log->create('GermaniaSacra', 'TYPO3\\Flow\\Log\\Logger', '\\TYPO3\\Flow\\Log\\Backend\\FileBackend', ['logFileUrl' => $this->logDirectory . $logFile, 'createParentDirectories' => true]); }