Exercise 3: Logging

Logging is a core factor in increasing the visibility and transparency of an application. When in troubleshooting or debugging scenarios, it is very important to pin-point the functionality that impacted the service.

In this exercise you will focus on bringing the logging capabilities to the previous application in Exercise 2.

  • A log line should be recorded when the localhost:8080/ endpoint is accessed.
  • The logs should be stored in a file named log.txt in the same directory as the application.
  • The log line should be formatted as follows: [timestamp] [level] [message]
  • The timestamp should be formatted as YYYY-MM-DD HH:MM:SS
  • The level should be formatted as [INFO] or [ERROR]
  • The message should be formatted as GET / <success or error message>