Source: paulund.co.uk

Laravel Log DB Queries
In this article we're going to look at how you can log all database queries that are executed within your Laravel application. There are multiple way in Laravel that help you with debugging your application, such as Debugbar and Telescope.

#default-loggingLaravel has some handle ways of logging in your application this is by using the Log Facade.

This method allows you to listen for any queries that are executed and log them to the log file.

#custom-log-fileIf you want to log all queries to a separate log file you can do this by using the useFiles method on the Log facade.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners