title: How to get last run query in CakePHP 3.2?
body: <p>I want to get the last executed query in CakePHP 3.2, I have used the following in CakePHP 2.x before:- </p>
  
  <pre><code>function getLastQuery() {
          Configure::write('debug', 2);
          $dbo = $this-&gt;getDatasource();
          $logs = $dbo-&gt;getLog();
          $lastLog = end($logs['log']);
          $latQuery = $lastLog['query'];
          echo "&lt;pre&gt;";
          print_r($latQuery);
      }
  </code></pre>
  
  <p>How can i do it  in CakePHP 3.x?</p>