Sometimes, while developing, you will encounter an unexpected error, and you'll have to find out why the error happened and how to solve it. On the other hand, it might happen that you have already deployed some customizations into a production environment and only months later, an end user calls with an unexpected error. If only there were some tools or features to let you check which steps the user took to reproduce the error. That's exactly why Salesforce has a monitoring and debugging functionality.
Monitoring and accessing debug logs
What is a debug log?
A debug log is a file that contains a detailed log for all database operations, underlying system processes, and eventual errors occurring while executing transactions...