Channeling your inner lumberjack – logging
Log messages are a critical piece of every application that should not go overlooked. If you are not familiar with what a "log message" is, then let's first understand its meaning. A log message is a simple way of thinking about a piece or collection of pieces of information that indicate what is happening in your application, either through direct user interaction or system processes running behind the scenes. This contextual information is written to the application log as a "message" that is stored and can be accessed at any time either in real time or historically by downloading archived log files.
Log messages are helpful in so many different areas of your application. They are especially helpful when you're working with error handling, as we discussed in the previous section. If your application experiences an error, it's very important to write a message to the log describing what happened...