In this recipe, you used the Logger class provided by the Java logging API to write log messages in a concurrent application. First of all, you implemented the MyFormatter class to assign a format to the log messages. This class extends the Formatter class that declares the abstract format() method. This method receives a LogRecord object with all of the information of the log message and returns a formatted log message. In your class, you used the following methods of the LogRecord class to obtain information about the log message:
- getLevel(): Returns the level of a message
- getMillis(): Returns the date when a message was sent to a Logger object
- getSourceClassName(): Returns the name of a class that had sent the message ...