Java Code Examples for java.util.logging.Logger#logrb()

The following examples show how to use java.util.logging.Logger#logrb() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestLogrbResourceBundle.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 2
Source File: TestLogrbResourceBundle.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 3
Source File: TestLogrbResourceBundle.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 4
Source File: TestLogrbResourceBundle.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 5
Source File: TestLogrbResourceBundle.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 6
Source File: TestLogrbResourceBundle.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 7
Source File: TestLogrbResourceBundle.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 8
Source File: TestLogrbResourceBundle.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 9
Source File: TestLogrbResourceBundle.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 10
Source File: TestLogrbResourceBundle.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 11
Source File: TestLogrbResourceBundle.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 12
Source File: TestLogrbResourceBundle.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 13
Source File: TestLogrbResourceBundle.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void logrb(Logger logger, ResourceBundle bundle) {
    switch(this) {
        case LOGRB_NO_ARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy");
            break;
        case LOGRB_SINGLE_ARG:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy", "bar");
            break;
        case LOGRB_ARG_ARRAY:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Object[] { "bar", "baz"} );
            break;
        case LOGRB_VARARGS:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    "bar", "baz" );
            break;
        case LOGRB_THROWABLE:
            logger.logrb(Level.CONFIG,
                    TestLogrbResourceBundle.class.getName(),
                    "main", bundle, "dummy",
                    new Exception("dummy exception") );
            break;
        default:
    }
}
 
Example 14
Source File: TestInferCaller.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void test2(Logger logger) {
    AtomicInteger count = new AtomicInteger();
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
    logger.setLevel(Level.ALL);
    assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");

    for (Level l : Arrays.asList(Level.SEVERE, Level.WARNING, Level.INFO,
            Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST)) {
        System.out.println("test2: " + loggerName(logger) + " " + l);
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");

        logger.log(l, "message " + count.incrementAndGet());
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        LogEvent event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

        logger.log(l, "message " + count.incrementAndGet(), "param");
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

        logger.log(l, "message " + count.incrementAndGet(), new Object[] {"foo", "bar"});
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

        logger.log(l, "message " + count.incrementAndGet(), new RuntimeException());
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

        // JDK 8 & 9 only (uses lambda)
        logger.log(l, () -> "message " + count.incrementAndGet());
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

        // JDK 8 & 9 only (uses lambda)
        logger.log(l, new RuntimeException(), () -> "message " + count.incrementAndGet());
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

        // JDK 9 only: new API
        logger.logrb(l, (ResourceBundle)null, "message " + count.incrementAndGet(), (Object[]) null);
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

        // JDK 9 only: new API
        logger.logrb(l, (ResourceBundle)null, "message " + count.incrementAndGet(), new RuntimeException());
        assertEquals(1, TestHandler.PUBLISHED.size(), "No event in queue: ");
        event = TestHandler.PUBLISHED.remove();
        assertEquals(0, TestHandler.PUBLISHED.size(), "Queue should be empty: ");
        checkEvent(event, this.getClass().getName(), "test2", "message " + count.get());

    }
}