Logging an Exception
import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; //package com.mycompany; public class Main { public static void main(String[] argv) { Logger logger = Logger.getLogger("com.mycompany.MyClass"); try { throw new IOException(); } catch (Throwable e) { logger.log(Level.SEVERE, "Uncaught exception", e); } Exception ex = new IllegalStateException(); logger.throwing("Main class", "myMethod", ex); } }