Package java.util.logging

Examples of java.util.logging.Formatter.format()


            System.setProperty(LINE_SEPARATOR_KEY, lineSeparatorValue);
            final LogRecord logRecordInput = new LogRecord(level, logMessage);
            logRecordInput.setThrown(null);

            final Formatter formatter = new SimpleTomEEFormatter();
            final String actualFormatOutput = formatter.format(logRecordInput);

            final StringBuilder expectedFormatOutputSb = new StringBuilder(level.getLocalizedName());
            expectedFormatOutputSb.append(" - ").append(logMessage).append("\n");
            final String expectedFormatOutput = expectedFormatOutputSb.toString();
View Full Code Here


            System.setProperty(LINE_SEPARATOR_KEY, lineSeparatorValue);
            final LogRecord logRecordInput = new LogRecord(level, logMessage);
            logRecordInput.setThrown(thrown);

            final Formatter formatter = new SimpleTomEEFormatter();
            final String actualFormatOutput = formatter.format(logRecordInput);

            final StringBuilder expectedFormatOutputSb = new StringBuilder(level.getLocalizedName());
            expectedFormatOutputSb.append(" - ").append(logMessage).append(lineSeparatorValue);
            expectedFormatOutputSb.append(ExceptionUtils.getStackTrace(thrown));
View Full Code Here

            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];
                logMessages.append(logFormatter.format(record));
            }
            return logMessages.toString();
        } catch (final Exception ex) {
            // We don't want to throw an exception here, but we
            // report the exception to any registered ErrorManager.
View Full Code Here

            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];
                logMessages.add(logFormatter.format(record));
            }
            return logMessages.toArray(new String[logMessages.size()]);
        } catch (final Exception ex) {
            // We don't want to throw an exception here, but we
            // report the exception to any registered ErrorManager.
View Full Code Here

    {
      final String formatted;
      final Formatter formatter = getFormatter();
      try
      {
          formatted = formatter.format(logRecord);
      }
      catch (Exception ex)
      {
          reportError("Formatting error", ex, ErrorManager.FORMAT_FAILURE);
          return;
View Full Code Here

      fmt = msgformat;
      style = msgStyle;
    }
    // format
    final String m;
    m = fmt.format(record);
    if(record instanceof ProgressLogRecord) {
      if(lastNewlinePos < getStyledDocument().getLength()) {
        getStyledDocument().remove(lastNewlinePos, getStyledDocument().getLength() - lastNewlinePos);
      }
    }
View Full Code Here

      fmt = msgformat;
      style = msgStyle;
    }
    // format
    final String m;
    m = fmt.format(record);
    if(record instanceof ProgressLogRecord) {
      if(lastNewlinePos < getStyledDocument().getLength()) {
        getStyledDocument().remove(lastNewlinePos, getStyledDocument().getLength() - lastNewlinePos);
      }
    }
View Full Code Here

      else {
        // default to the message formatter.
        fmt = msgformat;
      }
      try {
        m = fmt.format(record);
      }
      catch(Exception ex) {
        reportError(null, ex, ErrorManager.FORMAT_FAILURE);
        return;
      }
View Full Code Here

      else {
        // default to the message formatter.
        fmt = msgformat;
      }
      try {
        m = fmt.format(record);
      }
      catch(Exception ex) {
        reportError(null, ex, ErrorManager.FORMAT_FAILURE);
        return;
      }
View Full Code Here

  public void publish(LogRecord record) {
    if (!isLoggable(record)) {
      return;
    }
    Formatter formatter = getFormatter();
    String msg = formatter.format(record);
    // We want to make sure that unescaped messages are not output as HTML to
    // the window and the HtmlLogFormatter ensures this. If you want to write a
    // new formatter, subclass HtmlLogFormatter and override the getHtmlPrefix
    // and getHtmlSuffix methods.
    if (formatter instanceof HtmlLogFormatter) {
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.