Objectives
- Use the Java logging facility
- Discuss advantages and disadvantages of logging in Java
Note how setting the log level in code of the console logger only matters if the configuration file allows logging at the specified levels. The default level is INFO.
Note how the file log has a different logging level than the console. Note also that the output to the file defaults to XML format. You can specify your own formatter or use one of the built-in formatters. The console default formatter produces a simple text output. You can have quite a bit of detail recorded in the log entries. Notice that the XML format log entries include the class and method where the log entry came from.