mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Set back the logger on Elasticsearch client, not pleased with the format
This commit is contained in:
@@ -22,6 +22,8 @@ use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus;
|
||||
use Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine;
|
||||
use Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngineSubscriber;
|
||||
use Elasticsearch\Client;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Monolog\Logger;
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
|
||||
@@ -91,11 +93,18 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
|
||||
|
||||
$app['elasticsearch.client'] = $app->share(function($app) {
|
||||
$options = $app['elasticsearch.options'];
|
||||
$host = sprintf('%s:%s', $options['host'], $options['port']);
|
||||
$clientParams = ['hosts' => [sprintf('%s:%s', $options['host'], $options['port'])]];
|
||||
|
||||
// TODO (mdarse) Add logging support
|
||||
// Create file logger for debug
|
||||
if ($app['debug']) {
|
||||
$logger = new $app['monolog.logger.class']('search logger');
|
||||
$logger->pushHandler(new RotatingFileHandler($app['log.path'].DIRECTORY_SEPARATOR.'elasticsearch.log', 2), Logger::INFO);
|
||||
|
||||
return new Client(array('hosts' => array($host)));
|
||||
$clientParams['logObject'] = $logger;
|
||||
$clientParams['logging'] = true;
|
||||
}
|
||||
|
||||
return new Client($clientParams);
|
||||
});
|
||||
|
||||
$app['elasticsearch.options'] = $app->share(function($app) {
|
||||
|
@@ -63,13 +63,13 @@ class SearchEngineOptions
|
||||
|
||||
/**
|
||||
*
|
||||
* @var DateTime
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_min;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var DateTime
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $date_max;
|
||||
|
||||
|
@@ -24,7 +24,7 @@ main:
|
||||
type: ArrayCache
|
||||
options: []
|
||||
search-engine:
|
||||
type: Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine
|
||||
type: elasticsearch
|
||||
options: []
|
||||
task-manager:
|
||||
status: started
|
||||
|
Reference in New Issue
Block a user