Author: david.lloyd(a)jboss.com
Date: 2008-07-17 21:48:26 -0400 (Thu, 17 Jul 2008)
New Revision: 4381
Modified:
remoting3/trunk/testing-support/src/main/java/org/jboss/cx/remoting/test/support/LoggingHelper.java
Log:
Print relative times in the test log
Modified:
remoting3/trunk/testing-support/src/main/java/org/jboss/cx/remoting/test/support/LoggingHelper.java
===================================================================
---
remoting3/trunk/testing-support/src/main/java/org/jboss/cx/remoting/test/support/LoggingHelper.java 2008-07-17
22:49:31 UTC (rev 4380)
+++
remoting3/trunk/testing-support/src/main/java/org/jboss/cx/remoting/test/support/LoggingHelper.java 2008-07-18
01:48:26 UTC (rev 4381)
@@ -36,6 +36,7 @@
*/
public final class LoggingHelper {
private static final class Once {
+ private static final long startTime = System.currentTimeMillis();
static {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
@@ -47,6 +48,12 @@
handler.setFormatter(new Formatter() {
public String format(final LogRecord record) {
StringBuilder builder = new StringBuilder();
+ long offs = record.getMillis() - startTime;
+ final String sign = offs < 0 ? "-" :
"+";
+ offs = Math.abs(offs);
+ int ms = (int) (offs % 1000L);
+ long s = offs / 1000L;
+ builder.append(String.format("%s%04d.%03d ",
sign, Long.valueOf(s), Long.valueOf(ms)));
builder.append(record.getLevel().toString());
builder.append("
[").append(record.getLoggerName()).append("] ");
builder.append(String.format(record.getMessage(),
record.getParameters()));
Show replies by date