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\PhraseaEngine;
|
||||||
use Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngineSubscriber;
|
use Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngineSubscriber;
|
||||||
use Elasticsearch\Client;
|
use Elasticsearch\Client;
|
||||||
|
use Monolog\Handler\RotatingFileHandler;
|
||||||
|
use Monolog\Logger;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ServiceProviderInterface;
|
use Silex\ServiceProviderInterface;
|
||||||
|
|
||||||
@@ -90,12 +92,19 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$app['elasticsearch.client'] = $app->share(function($app) {
|
$app['elasticsearch.client'] = $app->share(function($app) {
|
||||||
$options = $app['elasticsearch.options'];
|
$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) {
|
$app['elasticsearch.options'] = $app->share(function($app) {
|
||||||
|
@@ -63,13 +63,13 @@ class SearchEngineOptions
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var DateTime
|
* @var \DateTime
|
||||||
*/
|
*/
|
||||||
protected $date_min;
|
protected $date_min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var DateTime
|
* @var \DateTime
|
||||||
*/
|
*/
|
||||||
protected $date_max;
|
protected $date_max;
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ main:
|
|||||||
type: ArrayCache
|
type: ArrayCache
|
||||||
options: []
|
options: []
|
||||||
search-engine:
|
search-engine:
|
||||||
type: Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine
|
type: elasticsearch
|
||||||
options: []
|
options: []
|
||||||
task-manager:
|
task-manager:
|
||||||
status: started
|
status: started
|
||||||
|
Reference in New Issue
Block a user