Skip to content
AgileLogics
3 min read

Logging Errors

Prerequisites: Debugging with Xdebug

A real application logs errors instead of displaying them to visitors (revisiting the warning from Debugging Basics, Level 1):

error_log("Payment failed for order #{$orderId}: {$e->getMessage()}");

Monolog (the most widely used PHP logging library, and what Laravel/Symfony use under the hood) adds log levels (INFO/WARNING/ERROR) and multiple destinations (file, email, Slack) on top of this same idea.