November 2017
Intermediate to advanced
398 pages
10h 14m
English
This is the core logging offering of Java and is maintained by the Java team, so you can rely on the support. However, this framework has some limitations, which are discussed in the Performance section.
The following is an example of using JUL in your code:
import java.util.logging.*;public class JULExample1 { private static final Logger logger = Logger.getLogger(JULExample1.class.getName()); public static void main(String[] args) { logger.info("Info logging level example"); try { Object o = null; if(o == null){ logger.log(Level.WARNING, "Object is null"); } o.toString(); //this line is going to throw a null pointer exception } catch (Exception ex){ logger.log(Level.SEVERE, ex.getMessage(), ex); } }}
The previous algorithm ...