src/Listener/ApiQueryLogListener.php
public function setupLogging(Event $event)
    {
        foreach ($this->_getSources() as $connectionName) {
            try {
                $connection = $this->_getSource($connectionName);

                if (method_exists($connection, 'enableQueryLogging')) {
                    $connection->enableQueryLogging(true);
                } else {
                    $connection->logQueries(true);
                }

                $connection->setLogger(new QueryLogger());
            } catch (MissingDatasourceConfigException $e) {
                //Safe to ignore this :-)
            }
        }
    }
public function setupLogging(Event $event)
    {
        foreach ($this->_getSources() as $connectionName) {
            try {
                $connection = $this->_getSource($connectionName);

                if (method_exists($connection, 'enableQueryLogging')) {
                    $connection->enableQueryLogging(true);
                } else {
                    $connection->logQueries(true);
                }

                $connection->setLogger(new QueryLogger());
            } catch (MissingDatasourceConfigException $e) {
                //Safe to ignore this :-)
            }
        }
    }
public function setupLogging ( Event $ event ) { foreach ( $ this -> _getSources ( ) as $ connectionName ) { try { $ connection = $ this -> _getSource ( $ connectionName ) ; if ( method_exists ( $ connection , 'enableQueryLogging' ) ) { $ connection -> enableQueryLogging ( true ) ; } else { $ connection -> logQueries ( true ) ; } $ connection -> setLogger ( new QueryLogger ( ) ) ; } catch ( MissingDatasourceConfigException $ e ) { //Safe to ignore this :-) } } }
Setup logging for all connections

@param \Cake\Event\Event $event Event
@return void
Setup logging for all connections