Logging a Method Call
import java.util.logging.Level; import java.util.logging.Logger; //package com.mycompany; class MyClass { public boolean myMethod(int p1, Object p2) { Logger logger = Logger.getLogger("com.mycompany.MyClass"); if (logger.isLoggable(Level.FINER)) { logger.entering(this.getClass().getName(), "myMethod", new Object[] { new Integer(p1), p2 }); } System.out.println("Method body"); boolean result = true; if (logger.isLoggable(Level.FINER)) { logger.exiting(this.getClass().getName(), "myMethod", new Boolean(result)); logger.exiting(this.getClass().getName(), "myMethod"); } return result; } }