There are 3 main logs that Magento 2 writes depending on the type of error: debug.log, exception.log, and system.log

Exception errors are being written to either debug.log or exception.log depending on the configuration also from the backend.

Logs can be found in <install_directory>/var/log/ directory

Because a log file is a long list of logs, sometimes it is hard to read/check the latest lines of logs if you are viewing the log file. The best way to print only the last few number of lines of logs is to use the terminal and use the tail command. In this example, I’m gonna print the last 200 lines of the debug.log file

1. cd to the root M2 installation: cd ~/keys.express/

2. Using the tail command: tail -f -n200 var/log/debug.log then press enter.

3. While the terminal is actively printing the last 200 lines of the debug.log file, you can do a test transaction from the storefront or backend of Magento.

4. To exit from the tail command, you can press Ctrl+C for windows and Linux or Command+C for Mac.

What are your feelings
Updated on November 8, 2022