Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Error logging to text file

Is there some standard way to enable error logging to plain text file or do I have to add try catch blocks manually everywhere like described here?



376
Accepted
answer

Use set_exception_handler

set_exception_handler(function (\Exception $e) {
    ...
    $di['logger']->error($e->getMessage());
});

Thanks, Óscar Enríquez.