replaced Tracer printlns with jboss-logging
@@ -4,6 +4,8 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.jboss.logging.Logger;
+
import io.smallrye.faulttolerance.core.FaultToleranceStrategy;
import io.smallrye.faulttolerance.core.InvocationContext;
@@ -12,6 +14,9 @@ import io.smallrye.faulttolerance.core.InvocationContext;
* This should eventually be replaced by some form of debug logging present directly in the code.
*/
public class Tracer<V> implements FaultToleranceStrategy<V> {
+
+ private static final Logger log = Logger.getLogger(Tracer.class);
+
private static final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
private final FaultToleranceStrategy<V> delegate;
@@ -22,13 +27,17 @@ public class Tracer<V> implements FaultToleranceStrategy<V> {
@Override
public V apply(InvocationContext<V> ctx) throws Exception {
- System.out.println(df.format(new Date()) + " [" + Thread.currentThread().getName() + "] invoking "
+ if (log.isDebugEnabled()) {
+ log.debug(df.format(new Date()) + " [" + Thread.currentThread().getName() + "] invoking "
+ delegate.getClass().getSimpleName());
+ }
try {
return delegate.apply(ctx);
} finally {
- System.out.println(df.format(new Date()) + " [" + Thread.currentThread().getName() + "] finished "
+ if (log.isDebugEnabled()) {
+ log.debug(df.format(new Date()) + " [" + Thread.currentThread().getName() + "] finished "
+ delegate.getClass().getSimpleName());
}
}
}
+}
