Enabling the debug log on Magento 2.3.1
=======
Since 2.3.1, things have changed a bit. As described in the [DevDocs article here][1], run this command:

`php bin/magento setup:config:set --enable-debug-logging=true && php bin/magento cache:flush`

Enabling the debug log on Magento 2.2
=====

In Magento 2.2, debugging can be enabled from either the GUI admin panel or from the command line.

First, check which mode your site is in by opening your Magento application directory (the one with index.php) in the shell. Then enter:

`php bin/magento deploy:mode:show`

If it says "production", only the command line method will work. Otherwise, the GUI method will work too.

GUI method
-----
In the Magento admin panel, go to "Stores" -> "Configuration" -> "Advanced" -> "Developer" -> "Debug" -> "Log to File". Setting this to "Yes" will cause debug information to be logged to `var/log/debug.log` in your Magento application directory.

[![The log to File option in the control panel.][2]][2]

After saving the setting, you may get a prompt at the top of the page asking you to flush the cache. If this appears, flush the Magento cache with the link it gives you.

If production mode is enabled (as displayed by `php bin/magento deploy:mode:show`) then the GUI option will not be available. Note that this the admin panel normally hides this in production mode, so only use this if you're testing.

Command line method
-----
First, open the Magento application directory (the one with index.php) in the shell. To enable debug logging enter:

`php bin/magento config:set dev/debug/debug_logging 1 && php bin/magento cache:flush`

This will cause debug information to be logged to `var/log/debug.log` in your Magento application directory. To disable debug logging, enter:

`php bin/magento config:set dev/debug/debug_logging 0 && php bin/magento cache:flush`


  [1]: https://devdocs.magento.com/guides/v2.3/config-guide/cli/logging.html
  [2]: https://i.sstatic.net/4Jgh9.png