Skip to content

Instantly share code, notes, and snippets.

@ivanweiler
Last active April 18, 2017 07:45
Show Gist options
  • Save ivanweiler/92300cc86cbd9f7770830fa5aabfe765 to your computer and use it in GitHub Desktop.
Save ivanweiler/92300cc86cbd9f7770830fa5aabfe765 to your computer and use it in GitHub Desktop.
Magento 2 log database queries
<?xml version="1.0"?>
<!--
/**
* Log Db Queries
* Copy to /app/etc/local.di.xml (di.xml glob follows {*di.xml, */*di.xml} pattern)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\File"/>
<type name="Magento\Framework\DB\Logger\File">
<arguments>
<argument name="debugFile" xsi:type="string">debug/db.log</argument>
<argument name="logAllQueries" xsi:type="boolean">true</argument>
<argument name="logQueryTime" xsi:type="number">0.05</argument>
<argument name="logCallStack" xsi:type="boolean">false</argument>
</arguments>
</type>
</config>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment