Example usage for java.util.logging Logger entering

List of usage examples for java.util.logging Logger entering

Introduction

In this page you can find the example usage for java.util.logging Logger entering.

Prototype

public void entering(String sourceClass, String sourceMethod, Object params[]) 

Source Link

Document

Log a method entry, with an array of parameters.

Usage

From source file:MyHtmlFormatter.java

public static void main(String[] argv) throws Exception {
    Logger logger = Logger.getLogger("com.mycompany");
    FileHandler fh = new FileHandler("mylog.html");
    fh.setFormatter(new MyHtmlFormatter());
    logger.addHandler(fh);//w w w  .j  av a  2  s  . c  o m

    logger.setLevel(Level.ALL);
    logger.severe("my severe message");
    logger.info("my info message");
    logger.entering("Main class", "myMethod", new Object[] { "para1", "para2" });
}

From source file:MyClass.java

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 });
    }//from  w  w w.  j av a  2s .  c  o  m

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