Example usage for java.util.logging LogRecord getMessage

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

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Get the "raw" log message, before localization or formatting.

Usage

From source file:HTMLFormatter.java

public String format(LogRecord record) {
    return ("<tr><td>" + (new Date(record.getMillis())).toString() + "</td><td>" + record.getMessage()
            + "</td></tr>\n");
}

From source file:CustomFormatter.java

public synchronized String format(LogRecord record) {
    String methodName = record.getSourceMethodName();
    String message = record.getMessage();
    StringBuffer buffer = new StringBuffer(50);
    buffer.append(methodName);//  ww  w. j a v a 2s.  co m
    buffer.append("=");
    buffer.append(message);
    return buffer.toString();
}

From source file:com.dsh105.echopet.compat.api.plugin.ModuleLogger.java

@Override
public void log(LogRecord logRecord) {
    logRecord.setMessage(this.prefix + logRecord.getMessage());
    super.log(logRecord);
}

From source file:org.broadleafcommerce.common.logging.Log4JRemoteGwtLoggingService.java

@Override
public String logOnServer(LogRecord record) {

    Level level = record.getLevel();
    String message;// w ww .j  a v a2  s  . c o m
    message = record.getMessage();
    if (Level.INFO.equals(level)) {
        LOG.info(message, record.getThrown());
    } else if (Level.SEVERE.equals(level)) {
        LOG.error(message, record.getThrown());
    } else if (Level.WARNING.equals(level)) {
        LOG.warn(message, record.getThrown());
    } else if (Level.FINE.equals(level)) {
        LOG.debug(message, record.getThrown());
    } else {
        LOG.error(message, record.getThrown());
    }

    return null;
}

From source file:com.p000ison.dev.simpleclans2.dataserver.ServerLoggerHandler.java

@Override
public Formatter getFormatter() {
    return new Formatter() {

        @Override/*from   w w  w. j  av a 2s.  c  om*/
        public String format(LogRecord record) {
            String message = DATE_FORMAT.format(record.getMillis()) + " [" + record.getLevel().toString() + "] "
                    + record.getMessage() + "\n";
            if (record.getThrown() != null) {
                message += ExceptionUtils.getStackTrace(record.getThrown()) + '\n';
            }
            return message;
        }
    };
}

From source file:org.broadleafcommerce.common.logging.Log4JRemoteGwtLoggingServlet.java

@Override
public String logOnServer(LogRecord record) {

    Level level = record.getLevel();
    String message;//from w  ww  .  jav a  2  s  . c  o  m
    message = getThreadLocalRequest().getRemoteAddr() + ":" + record.getMessage();
    if (Level.INFO.equals(level)) {
        LOG.info(message, record.getThrown());
    } else if (Level.SEVERE.equals(level)) {
        LOG.error(message, record.getThrown());
    } else if (Level.WARNING.equals(level)) {
        LOG.warn(message, record.getThrown());
    } else if (Level.FINE.equals(level)) {
        LOG.debug(message, record.getThrown());
    } else {
        LOG.error(message, record.getThrown());
    }

    return null;
}

From source file:com.github.hronom.scrape.dat.rooms.core.grabbers.JxBrowserGrabber.java

private Handler createHandler() {
    return new Handler() {
        @Override/*  ww w  .  ja v a 2  s . c om*/
        public void publish(LogRecord record) {
            if (record.getLevel() == Level.INFO) {
                logger.info(record.getMessage());
            } else if (record.getLevel() == Level.WARNING) {
                logger.warn(record.getMessage());
            } else if (record.getLevel() == Level.SEVERE) {
                logger.fatal(record.getMessage());
            } else {
                logger.info(record.getMessage());
            }
        }

        @Override
        public void flush() {

        }

        @Override
        public void close() throws SecurityException {

        }
    };
}

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

@Override
public void publish(LogRecord lr) {
    if (isIgnoringLogRecord(lr)) {
        return;//from   ww  w  .j a  va  2s. co m
    }

    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:org.ensembl.healthcheck.testcase.AbstractPerlModuleBasedTestCase.java

/** 
 * @return formatter for log messages originating in a perl based healthcheck.
 *///w  w  w . jav  a2 s  .co m
protected Formatter createPerlLogMessageFormatter() {

    return new Formatter() {

        @Override
        public String formatMessage(LogRecord logRecord) {
            return logRecord.getMessage();
        }

        @Override
        public String format(LogRecord logRecord) {
            return formatMessage(logRecord) + "\n";
        }
    };
}

From source file:org.syphr.mythtv.test.ConsoleFormatter.java

@Override
public String format(LogRecord record) {
    StringBuilder formattedRecord = new StringBuilder(
            StringUtils.rightPad(record.getSourceClassName(), 65, '.'));
    formattedRecord.append(" | ");

    String message = record.getMessage();
    formattedRecord.append(message != null ? message : " no message provided");
    formattedRecord.append(NEWLINE);//ww w  .j  av a  2  s .com

    Throwable thrown = record.getThrown();
    if (thrown != null) {
        StringWriter sw = new StringWriter();
        thrown.printStackTrace(new PrintWriter(sw));
        formattedRecord.append(sw);
    }

    return formattedRecord.toString();
}