Logging is used to track the execution path of a program.
Ideally, using only the logs, you should be able to tell what point an application is currently at. If you are creating a web application, this becomes more difficult, as there will be many users, but the logs should be able to distinguish what kinds of executions are happening.
As I mentioned here there are generally different levels of logging, depending on what development stage you are at.
Early in development you are likely to want to log pretty much everything. Later on, you are going to only want to log the major sticking points, so that you app can run smoothly.
Logs can therefore be critical to debugging (where did it break), but they can also be used for security purposes (tracking logins and logouts), and usage statistics (how many concurrent users).
Logging is something that should be included in every architecture design so that you will be able to identify errors before they occur.