Example usage for java.util.logging Logger exiting

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

Introduction

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

Prototype

public void exiting(String sourceClass, String sourceMethod, Object result) 

Source Link

Document

Log a method return, with result object.

Usage

From source file:mockit.integration.logging.MoreLoggingIntegrationsTest.java

@Test
public void jdkLoggingShouldLogNothing() {
    Logger log1 = Logger.getAnonymousLogger();

    log1.entering("testing that logger does nothing", "method");
    log1.exiting("testing that logger does nothing", "method", new Object());
}

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 });
    }/* ww w  .ja  v a 2  s .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;
}

From source file:com.zacwolf.commons.crypto._CRYPTOfactory.java

public final _CRYPTOfactory test(Logger logger, String[] testargs) {
    try {//from  w  w w . j  av a  2s.c  o  m
        final File testfile = createTempFile("_CRYPTOfactory" + this.getType() + "_Test", ".tmp");

        logger.finer(this.getClass().getName() + ":TEST:" + this.getType() + ":.crypt(\"" + testargs[0]
                + "\"):RESULT:"
                + new String(this.decrypt(this.encrypt(testargs[0].getBytes(_CRYPTOfactory.ENCODING))),
                        _CRYPTOfactory.ENCODING));

        this.encryptToOutputStream(testargs[0].getBytes(_CRYPTOfactory.ENCODING),
                new FileOutputStream(testfile));
        logger.finer(this.getClass().getName() + ":TEST:" + this.getType() + ":.cryptToOutputStream(\""
                + testargs[0] + "\"):RESULT:" + new String(
                        this.decryptFromInputStream(new FileInputStream(testfile)), _CRYPTOfactory.ENCODING));
        testfile.delete();

        if (!this.getType().equalsIgnoreCase("RSA")) {
            this.encryptObjToOutputStream(new TestSerObj(testargs), new FileOutputStream(testfile));
            logger.finer("_CRYPTOfactory:TEST:" + this.getType() + ":.cryptObjToOutputStream:RESULT:"
                    + this.decryptObjFromInputStream(new FileInputStream(testfile)));
            logger.finer(this.getClass().getName() + ":TEST:Fully initialized " + this.crypter.getType()
                    + " cipher\n");
            testfile.delete();
        }
    } catch (Exception e) {
        if (e instanceof InvalidKeyException && this.crypter instanceof Crypter_RSA) {
            logger.fine("Unable to test an RSACypter with only a public key");
        } else {
            logger.severe(this.getClass().getName() + ":TEST:" + this.crypter.getType() + ":ERROR:" + e + "\n");
            e.printStackTrace();
        }
    } finally {
        logger.exiting(this.getClass().getName(), "test()", JVM.getMemoryStats());
    }
    return this;//So that it can be chained with the constructor call
}