Examples of LogRecord


Examples of java.util.logging.LogRecord

            try {
               log.info("Dump start");
               I_Authenticate auth = xmlBlasterMain.getAuthenticate();
               StringBuffer buf = new StringBuffer(auth.toXml());
               buf.append(xmlBlasterMain.getXmlBlaster().toXml());
               LogRecord record = new LogRecord(Level.INFO, buf.toString());
               log(record);
               log.info("Dump end");
            }
            catch(XmlBlasterException ee) {
               log.severe("Sorry, dump failed: " + ee.getMessage());
View Full Code Here

Examples of java.util.logging.LogRecord

    });
    LoggingPanel lp=new LoggingPanel(f,"test",null);
    f.getContentPane().add(lp);

    LoggingTableModel lm=(LoggingTableModel)lp.getLogbookModel();
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.SEVERE,"DEAD")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.WARNING,"CAUTION")));
        lm.add(new LogRecordLoggingEntry(new LogRecord(SimtoolsLevel.USER_WARNING,"titi")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.INFO,"YES")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.CONFIG,"NO")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.FINE,"WHY")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.FINER,"WHO")));
    lm.add(new LogRecordLoggingEntry(new LogRecord(Level.FINEST,"WHEN")));
   
    f.pack();
    f.show();
  }
View Full Code Here

Examples of java.util.logging.LogRecord

    public void testLogParamsSubstitutionWithThrowable() throws Exception {
        Handler handler = EasyMock.createNiceMock(Handler.class);
        LOG.addHandler(handler);
        // 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

Examples of java.util.logging.LogRecord

            this.record = r;
        }

        public boolean matches(Object obj) {
            if (obj instanceof LogRecord) {
                LogRecord other = (LogRecord)obj;
                return record.getMessage().equals(other.getMessage())
                       && record.getLevel().equals(other.getLevel())
                       && record.getThrown() == other.getThrown();
            }
            return false;
        }   
View Full Code Here

Examples of java.util.logging.LogRecord

    public void testHandleL7dMessage() throws Exception {
        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

Examples of java.util.logging.LogRecord

    public void testLogParamSubstitutionWithThrowable() throws Exception {
        Handler handler = EasyMock.createNiceMock(Handler.class);
        LOG.addHandler(handler);
        // 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

Examples of java.util.logging.LogRecord

            msg = "Missing [msg] parameter";
        }

        if (logger.isLoggable(level))
        {
            LogRecord result = new LogRecord(level, String.valueOf(msg));
            if (thrown != null)
                result.setThrown(thrown);
            StackTraceElement[] stacktrace = new Throwable().getStackTrace();
            for (int i = 0; i < stacktrace.length; i++)
            {
                StackTraceElement element = stacktrace[i];
                if (!element.getClassName().equals(JDK14Logger.class.getName()))
                {
                    result.setSourceClassName(element.getClassName());
                    result.setSourceMethodName(element.getMethodName());
                    break;
                }
            }
            logger.log(result);
        }
View Full Code Here

Examples of java.util.logging.LogRecord

    public final synchronized LogRecord[] getLogArray(final Long sequenceNumberStart) {
        final List<LogRecord> tempBuffer = new ArrayList<LogRecord>(this.count);
       
        for (int i = 0; i < this.count; i++) {
            final int ix = (this.start+i)%this.buffer.length;
            final LogRecord record = this.buffer[ix];
            if ((sequenceNumberStart == null) || (record.getSequenceNumber() >= sequenceNumberStart.longValue())) {
              tempBuffer.add(record);
            }
        }
       
        return tempBuffer.toArray(new LogRecord[tempBuffer.size()]);
View Full Code Here

Examples of java.util.logging.LogRecord

        final StringBuilder logMessages = new StringBuilder(this.count*40);
        final Formatter logFormatter = getFormatter();
       
        try {
            final int theStart = (reversed)?this.start+this.count-1:this.start;
            LogRecord record=null;
            for (int i = 0; i < lineCount; i++) {
                final int ix = (reversed) ?
                    Math.abs((theStart-i)%this.buffer.length) :
                    (theStart+i)%this.buffer.length;
                record = this.buffer[ix];
View Full Code Here

Examples of java.util.logging.LogRecord

        final List<String> logMessages = new ArrayList<String>(this.count);
        final Formatter logFormatter = getFormatter();
       
        try {
            final int theStart = (reversed) ? this.start+this.count-1 : this.start+this.count-lineCount;
            LogRecord record=null;
            for (int i = 0; i < lineCount; i++) {
                final int ix = (reversed) ?
                    Math.abs((theStart-i)%this.buffer.length) :
                    (theStart + i) % this.buffer.length;
                record = this.buffer[ix];
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.