Search in sources :

Example 1 with TextFormatter

use of com.yahoo.logserver.formatter.TextFormatter in project vespa by vespa-engine.

the class TextFormatterTestCase method testSpecificMessage.

/**
 * Test that a specific log message is formatted correctly
 */
@Test
public void testSpecificMessage() throws InvalidLogFormatException {
    String l = "1115200798.195568\texample.yahoo.com\t65819\ttopleveldispatch\tfdispatch.queryperf\tevent\tvalue/1 name=\"query_eval_time_avg_s\" value=0.0229635972697721825";
    String result = "2005-05-04 09:59:58 example.yahoo.com 65819 topleveldispatch fdispatch.queryperf EVENT value/1 name=\"query_eval_time_avg_s\" value=0.0229635972697721825\n";
    LogMessage m = LogMessage.parseNativeFormat(l);
    TextFormatter tf = new TextFormatter();
    assertEquals(result, tf.format(m));
}
Also used : TextFormatter(com.yahoo.logserver.formatter.TextFormatter) LogMessage(com.yahoo.log.LogMessage)

Example 2 with TextFormatter

use of com.yahoo.logserver.formatter.TextFormatter in project vespa by vespa-engine.

the class TextFormatterTestCase method testTextFormatter.

/**
 * Just simple test to make sure it doesn't die on us
 */
@Test
public void testTextFormatter() {
    TextFormatter tf = new TextFormatter();
    LogMessage[] ms = MockLogEntries.getMessages();
    for (int i = 0; i < ms.length; i++) {
        System.out.println(tf.format(ms[i]));
    }
}
Also used : TextFormatter(com.yahoo.logserver.formatter.TextFormatter) LogMessage(com.yahoo.log.LogMessage)

Aggregations

LogMessage (com.yahoo.log.LogMessage)2 TextFormatter (com.yahoo.logserver.formatter.TextFormatter)2