Logger: exiting(String sourceClass, String sourceMethod, Object result) : Logger « java.util.logging « Java by API






Logger: exiting(String sourceClass, String sourceMethod, Object result)

  
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;
  }
}

   
    
  








Related examples in the same category

1.Logger: addHandler(Handler handler)
2.Logger: config(String msg)
3.Logger: fine(String msg)
4.Logger: finer(String msg)
5.Logger: finest(String msg)
6.Logger: getAnonymousLogger()
7.Logger: getLogger(String name)
8.Logger: info(String msg)
9.Logger: isLoggable(Level level)
10.Logger: logp(Level level, String sourceClass, String sourceMethod, String msg)
11.Logger: severe(String msg)
12.Logger: setFilter(Filter newFilter)
13.Logger: setUseParentHandlers(boolean useParentHandlers)
14.Logger: warning(String msg)