Logging Information I

Let’s learn how to log information using the log.Fatal() and log.Panic() functions.

Although it is useful to print error messages onscreen, there are times that we need to keep all error messages together and be able to search them when it is convenient for us. In this case, we need to use one or more log files.

Introduction to logging information

Log files

All UNIX systems have their own log files for writing logging information that comes from running servers and programs. Usually, most system log files of a UNIX system can be found under the /var/log directory. However, the log files of many popular services, such as Apache and Nginx, can be found elsewhere, depending on their configuration.

Get hands-on with 1200+ tech skills courses.