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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners