Errorhandler with logger, should be in skeleton?

Some thoughts about error logging in expressive.

Looking at the docs for error handling and the section ‘Listening for errors’. I noticed two small things:

  1. Promoting the use of delegators is fine, but restricts usage to zend-service-manager. At least an option should be nice.
  2. Was a bit confused about where to register the LoggingErrorListenerDelegatorFactory… put it dependencies.php under ‘delegators’, but was not super intuitive (at least for me):
return [
    'dependencies' => [
        'factories' => [
            // ...
            Psr\Log\LoggerInterface::class                   => App\Infrastructure\Log\LoggerFactory::class,
        'delegators' => [
            Zend\Stratigility\Middleware\ErrorHandler::class => [

So everything is fine… but I found it a bit sad to have to spend an hour to just enable basic logging.

I think it could be good to have it in skeleton by default (with a NullLogger for example) and I would be happy to contribute a P/R, but would like to have some feedback first especially

  • How to emulate the delegators with Pimple, Aura.DI ?
  • What would be the ideal namespace (App\Infrastructure\Log) to choose to set the loggers ?

Any thoughts on this ? Or is there’s already something that could be easily provide global error logging ?

Opened an issue for the skeleton: just for open discussion.

No, it doesn’t. As of v2.0 of the skeleton, we support delegator factories in all DI containers we currently support (we even document how to write them to work across container implementations).

1 Like

I’ve provided feedback via your github issue:

1 Like