Search in sources :

Example 1 with LogRecord

use of java.util.logging.LogRecord in project buck by facebook.

the class JavaUtilsLoggingBuildListener method buildStarted.

@Subscribe
public void buildStarted(BuildEvent.Started started) {
    LogRecord record = new LogRecord(LEVEL, "Build started");
    record.setMillis(started.getTimestamp());
    LOG.log(record);
}
Also used : LogRecord(java.util.logging.LogRecord) Subscribe(com.google.common.eventbus.Subscribe)

Example 2 with LogRecord

use of java.util.logging.LogRecord in project buck by facebook.

the class JavaUtilsLoggingBuildListener method ruleStarted.

@Subscribe
public void ruleStarted(BuildRuleEvent.Started started) {
    LogRecord record = new LogRecord(LEVEL, started.toString());
    record.setMillis(started.getTimestamp());
    LOG.log(record);
}
Also used : LogRecord(java.util.logging.LogRecord) Subscribe(com.google.common.eventbus.Subscribe)

Example 3 with LogRecord

use of java.util.logging.LogRecord in project buck by facebook.

the class JavaUtilsLoggingBuildListener method ruleFinished.

@Subscribe
public void ruleFinished(BuildRuleEvent.Finished finished) {
    LogRecord record = new LogRecord(LEVEL, finished.toLogMessage());
    record.setMillis(finished.getTimestamp());
    LOG.log(record);
}
Also used : LogRecord(java.util.logging.LogRecord) Subscribe(com.google.common.eventbus.Subscribe)

Example 4 with LogRecord

use of java.util.logging.LogRecord in project buck by facebook.

the class JavaUtilsLoggingBuildListener method ruleSuspended.

@Subscribe
public void ruleSuspended(BuildRuleEvent.Suspended suspended) {
    LogRecord record = new LogRecord(LEVEL, suspended.toString());
    record.setMillis(suspended.getTimestamp());
    LOG.log(record);
}
Also used : LogRecord(java.util.logging.LogRecord) Subscribe(com.google.common.eventbus.Subscribe)

Example 5 with LogRecord

use of java.util.logging.LogRecord in project buck by facebook.

the class MemoryHandler method publish.

@Override
public void publish(LogRecord record) {
    if (!isLoggable(record)) {
        return;
    }
    List<LogRecord> recordsToLog = null;
    synchronized (buffer) {
        int ix = (start + count) % buffer.length;
        buffer[ix] = record;
        if (count < buffer.length) {
            count++;
        } else {
            start++;
            start %= buffer.length;
        }
        if (record.getLevel().intValue() >= pushLevel.intValue()) {
            recordsToLog = new ArrayList<>();
            while (count > 0) {
                LogRecord oldRecord = buffer[start];
                recordsToLog.add(oldRecord);
                buffer[start] = null;
                start++;
                start %= buffer.length;
                count--;
            }
        }
    }
}
Also used : LogRecord(java.util.logging.LogRecord)

Aggregations

LogRecord (java.util.logging.LogRecord)640 Test (org.junit.Test)122 Logger (java.util.logging.Logger)95 Handler (java.util.logging.Handler)51 IOException (java.io.IOException)35 File (java.io.File)31 Level (java.util.logging.Level)31 ArrayList (java.util.ArrayList)22 Formatter (java.util.logging.Formatter)21 ByteArrayOutputStream (java.io.ByteArrayOutputStream)19 SimpleFormatter (java.util.logging.SimpleFormatter)17 StreamHandler (java.util.logging.StreamHandler)17 ConsoleHandler (java.util.logging.ConsoleHandler)15 Properties (java.util.Properties)13 ErrorManager (java.util.logging.ErrorManager)12 Test (org.junit.jupiter.api.Test)12 SQLException (java.sql.SQLException)11 Date (java.util.Date)11 Test (org.testng.annotations.Test)11 Config (com.sun.enterprise.config.serverbeans.Config)10