Package java.util.logging

Examples of java.util.logging.Handler.publish()


        Handler handler = EasyMock.createNiceMock(Handler.class);
        LOG.addHandler(handler);
        // handler called *before* localization of message
        LogRecord record = new LogRecord(Level.WARNING, "FOOBAR_MSG");
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LOG.log(Level.WARNING, "FOOBAR_MSG");
        EasyMock.verify(handler);
    }

View Full Code Here


        // handler called *after* localization of message
        Exception ex = new Exception();
        LogRecord record = new LogRecord(Level.SEVERE, "subbed in 1 only");
        record.setThrown(ex);
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LogUtils.log(LOG, Level.SEVERE, "SUB1_MSG", ex, 1);
        EasyMock.verify(handler);
    }

View Full Code Here

        // handler called *after* localization of message
        Exception ex = new Exception();
        LogRecord record = new LogRecord(Level.SEVERE, "subbed in 4 & 3");
        record.setThrown(ex);
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LogUtils.log(LOG, Level.SEVERE, "SUB2_MSG", ex, new Object[] {3, 4});
        EasyMock.verify(handler);
    }

View Full Code Here

        LOG.addHandler(handler);
        // handler called *before* localization of message
        LogRecord record = new LogRecord(Level.WARNING, "FOOBAR_MSG");
        record.setResourceBundle(LOG.getResourceBundle());
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LOG.log(Level.WARNING, "FOOBAR_MSG");
        EasyMock.verify(handler);
        LOG.removeHandler(handler);
    }
View Full Code Here

        Handler handler = EasyMock.createNiceMock(Handler.class);
        LOG.addHandler(handler);
        // handler called *after* localization of message
        LogRecord record = new LogRecord(Level.SEVERE, "subbed in {0} only");
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LogUtils.log(LOG, Level.SEVERE, "SUB1_MSG");
        EasyMock.verify(handler);
        LOG.removeHandler(handler);
    }
View Full Code Here

        // handler called *after* localization of message
        Exception ex = new Exception("x");
        LogRecord record = new LogRecord(Level.SEVERE, "subbed in {0} only");
        record.setThrown(ex);
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LogUtils.log(LOG, Level.SEVERE, "SUB1_MSG", ex);
        EasyMock.verify(handler);
        LOG.removeHandler(handler);
    }
View Full Code Here

        // handler called *after* localization of message
        Exception ex = new Exception();
        LogRecord record = new LogRecord(Level.SEVERE, "subbed in 1 only");
        record.setThrown(ex);
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LogUtils.log(LOG, Level.SEVERE, "SUB1_MSG", ex, 1);
        EasyMock.verify(handler);
        LOG.removeHandler(handler);
    }
View Full Code Here

        // handler called *after* localization of message
        Exception ex = new Exception();
        LogRecord record = new LogRecord(Level.SEVERE, "subbed in 4 & 3");
        record.setThrown(ex);
        EasyMock.reportMatcher(new LogRecordMatcher(record));
        handler.publish(record);
        EasyMock.replay(handler);
        LogUtils.log(LOG, Level.SEVERE, "SUB2_MSG", ex, new Object[] {3, 4});
        EasyMock.verify(handler);
        LOG.removeHandler(handler);
    }
View Full Code Here

    @Override
    public void publish(LogRecord record) {
        Handler h = getEnvSpecificConfiguredHandler();
        if ((h != null) && (h.isLoggable(record))) {
            h.publish(record);
        }
    }

    private Handler getEnvSpecificConfiguredHandler() {
        EnvironmentImpl envImpl =
View Full Code Here

    }

    public void publish(LogRecord record) {
        Handler t = resolve();
        if(t!=null)
            t.publish(record);
    }

    public void flush() {
        Handler t = resolve();
        if(t!=null)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.