We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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.