Example usage for java.util.logging LogRecord getMillis

List of usage examples for java.util.logging LogRecord getMillis

Introduction

In this page you can find the example usage for java.util.logging LogRecord getMillis.

Prototype

public long getMillis() 

Source Link

Document

Get truncated event time in milliseconds since 1970.

Usage

From source file:org.spoutcraft.launcher.Main.java

@Override
public String format(LogRecord record) {
    StringBuilder builder = new StringBuilder();

    builder.append(date.format(record.getMillis()));
    builder.append(" [");
    builder.append(record.getLevel().getLocalizedName().toUpperCase());
    builder.append("] ");
    builder.append(formatMessage(record));
    builder.append('\n');

    if (record.getThrown() != null) {
        StringWriter writer = new StringWriter();
        record.getThrown().printStackTrace(new PrintWriter(writer));
        builder.append(writer.toString());
    }/*from  w  w  w .j  a  v a 2s. c  om*/

    return builder.toString();
}

From source file:pl.otros.logview.logging.GuiJulHandler.java

@Override
public void publish(LogRecord lr) {
    if (isIgnoringLogRecord(lr)) {
        return;/*from w w w. j a  v a  2 s  .  com*/
    }

    LogData ld = new LogData();
    ld.setMessage(lr.getMessage());
    ld.setDate(new Date(lr.getMillis()));
    ld.setFile("Olv-internal");
    ld.setClazz(lr.getSourceClassName());
    ld.setMethod(lr.getSourceMethodName());
    ld.setThread(Integer.toString(lr.getThreadID()));
    ld.setLevel(lr.getLevel());
    if (bufferingLogDataCollectorProxy != null) {
        bufferingLogDataCollectorProxy.add(ld);
    }
}

From source file:simj.util.logging.HTMLFormatter.java

private String getLogEntry(final LogRecord record) {
    StringBuffer buf = new StringBuffer(2048);

    buf.append("<TR>\n");
    buf.append("<TD><DIV ALIGN=\"right\">");
    buf.append(record.getSequenceNumber());
    buf.append("</DIV></TD>");
    buf.append("<TD>");

    // Bold any levels >= INFO, for instance severe error messages.
    if (record.getLevel().intValue() >= Level.INFO.intValue()) {
        buf.append("<b>");

        if (record.getLevel().intValue() >= Level.WARNING.intValue()) {
            buf.append("<i>");
            buf.append(record.getLevel());
            buf.append("</i>");
        } else {/*from www.jav a  2 s  . co  m*/
            buf.append(record.getLevel());
        }

        buf.append("</b>");
    } else {
        buf.append(record.getLevel());
    }

    buf.append("</TD>");
    buf.append("<TD>");
    buf.append(record.getMillis());
    buf.append("</TD>");
    buf.append("<TD>");
    buf.append(record.getSourceClassName());
    buf.append("</TD>");
    buf.append("<TD>");
    buf.append(record.getSourceMethodName());
    buf.append("</TD>");
    buf.append("<TD>");
    buf.append("\n</TR>\n");
    buf.append("<TR>\n");
    buf.append("<TD>");
    buf.append("</TD>");
    buf.append("<TD COLSPAN=\"4\">");
    buf.append("<EM>");
    buf.append(cleanUpHTML(formatMessage(record)));
    buf.append("</EM>");
    buf.append("</TD>");
    buf.append("\n</TR>\n");
    buf.append("<TR>");
    buf.append("<TD COLSPAN=\"5\"><HR SIZE=\"1\" NOSHADE></TD>");
    buf.append("</TR>\n\n");

    return buf.toString();
}