# How to Get the Query Executed in Laravel 5

By default, the query log is
[disabled](https://github.com/laravel/framework/commit/e0abfe5c49d225567cb4dfd56df9ef05cc297448)
in Laravel 5:

Don’t worry, you can enable the query log by running the following:

```php
// enable query log
DB::enableQueryLog();
```

Then you can display the log like this:

```php
// get the query log
dd(DB::getQueryLog());
```

Or alternatively, you can register an event listener and listen for logs:

```php
DB::listen(
    function ($sql, $bindings, $time) {
        //  $sql - contains the SQL query
    }
);
```
