Merge pull request #915 from romainneutron/error-logs

[3.8] Error logs
This commit is contained in:
Nicolas Le Goff
2014-02-03 10:47:09 -08:00
13 changed files with 25 additions and 4 deletions

View File

@@ -105,6 +105,8 @@ use Alchemy\Phrasea\Twig\JSUniqueID;
use Alchemy\Phrasea\Twig\Camelize;
use Alchemy\Phrasea\Twig\BytesConverter;
use FFMpeg\FFMpegServiceProvider;
use Monolog\Logger;
use Monolog\Processor\IntrospectionProcessor;
use Neutron\Silex\Provider\ImagineServiceProvider;
use MediaVorus\MediaVorusServiceProvider;
use MediaVorus\Utils\RawImageMimeTypeGuesser;
@@ -250,6 +252,11 @@ class Application extends SilexApplication
$this['monolog.handler'] = $this->share(function () {
return new NullHandler();
});
$this['monolog'] = $this->share($this->extend('monolog', function (Logger $monolog) {
$monolog->pushProcessor(new IntrospectionProcessor());
return $monolog;
}));
$this->register(new MP4BoxServiceProvider());
$this->register(new NotificationDelivererServiceProvider());
$this->register(new ORMServiceProvider());

View File

@@ -19,6 +19,8 @@ use Alchemy\Phrasea\Core\Event\ApiLoadEndEvent;
use Alchemy\Phrasea\Core\Event\ApiLoadStartEvent;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiOauth2ErrorsSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiExceptionHandlerSubscriber;
use Monolog\Logger;
use Monolog\Processor\WebProcessor;
use Silex\Application as SilexApplication;
use Symfony\Component\HttpFoundation\Request;
@@ -30,6 +32,11 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app['exception_handler'] = $app->share(function ($app) {
return new ApiExceptionHandlerSubscriber($app);
});
$app['monolog'] = $app->share($app->extend('monolog', function (Logger $monolog) {
$monolog->pushProcessor(new WebProcessor());
return $monolog;
}));
$app->register(new \API_V1_Timer());
$app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_START, new ApiLoadStartEvent());

View File

@@ -17,6 +17,8 @@ use Alchemy\Phrasea\Core\Event\Subscriber\BridgeExceptionSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\FirewallSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\JsonRequestSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\DebuggerSubscriber;
use Monolog\Logger;
use Monolog\Processor\WebProcessor;
use Silex\Provider\WebProfilerServiceProvider;
use Symfony\Component\HttpFoundation\Request;
@@ -28,6 +30,11 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app['exception_handler'] = $app->share(function ($app) {
return new PhraseaExceptionHandlerSubscriber($app['phraseanet.exception_handler']);
});
$app['monolog'] = $app->share($app->extend('monolog', function (Logger $monolog) {
$monolog->pushProcessor(new WebProcessor());
return $monolog;
}));
$app->before(function (Request $request) use ($app) {
if (0 === strpos($request->getPathInfo(), '/setup')) {

View File

@@ -33,7 +33,7 @@ class Datafiles extends AbstractDelivery
$controllers->before(function (Request $request) use ($app) {
if (!$app['authentication']->isAuthenticated()) {
$app->abort(403, 'You are not autorized to see this');
$app->abort(403, sprintf('You are not authorized to access %s', $request->getRequestUri()));
}
});