use of java.util.logging.LogRecord in project robovm by robovm.
the class OldFileHandlerTest method testPublish.
public void testPublish() throws Exception {
LogRecord[] r = new LogRecord[] { new LogRecord(Level.CONFIG, "msg__"), new LogRecord(Level.WARNING, "message"), new LogRecord(Level.INFO, "message for"), new LogRecord(Level.FINE, "message for test") };
for (int i = 0; i < r.length; i++) {
handler = new FileHandler("%t/log/stringPublish");
handler.publish(r[i]);
handler.close();
assertFileContent(TEMPPATH + SEP + "log", "stringPublish", new LogRecord[] { r[i] }, handler.getFormatter());
}
}
use of java.util.logging.LogRecord in project GCViewer by chewiebug.
the class TestDataReaderJRockit1_5_0 method testMalformedType.
/**
* Test parsing of a malformed type. The test just expects an INFO to be logged - nothing else.
*/
@Test
public void testMalformedType() throws Exception {
TestLogHandler handler = new TestLogHandler();
handler.setLevel(Level.INFO);
GCResource gcResource = new GcResourceFile("byteArray");
gcResource.getLogger().addHandler(handler);
ByteArrayInputStream in = new ByteArrayInputStream(("[memory ][Thu Feb 21 15:06:38 2013][11844] 6.290-6.424: GC-malformed 3128161K->296406K (3145728K), sum of pauses 59.084 ms").getBytes());
DataReader reader = new DataReaderJRockit1_5_0(gcResource, in);
reader.read();
// 3 INFO events:
// Reading JRockit ... format
// Failed to determine type ...
// Reading done.
assertEquals("number of infos", 3, handler.getCount());
List<LogRecord> logRecords = handler.getLogRecords();
assertEquals("should start with 'Failed to determine type'", 0, logRecords.get(1).getMessage().indexOf("Failed to determine type"));
}
use of java.util.logging.LogRecord in project GCViewer by chewiebug.
the class TestDataReaderJRockit1_6_0 method testMalformedType.
@Test
public void testMalformedType() throws Exception {
TestLogHandler handler = new TestLogHandler();
handler.setLevel(Level.INFO);
GCResource gcResource = new GcResourceFile("byteArray");
gcResource.getLogger().addHandler(handler);
ByteArrayInputStream in = new ByteArrayInputStream(("[INFO ][memory ] [YC#1] 9.743-9.793: YC-malformed 294974KB->122557KB (524288KB), 0.050 s, sum of pauses 49.692 ms, longest pause 49.692 ms.").getBytes());
DataReader reader = new DataReaderJRockit1_6_0(gcResource, in);
reader.read();
// 3 INFO events:
// Reading JRockit ... format
// Failed to determine type ...
// Reading done.
assertEquals("number of infos", 3, handler.getCount());
List<LogRecord> logRecords = handler.getLogRecords();
assertEquals("should start with 'Failed to determine type'", 0, logRecords.get(1).getMessage().indexOf("Failed to determine type"));
}
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);
}
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);
}
Aggregations