From 5abd96f254b45978d2f07b61d74058543098e226 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Sat, 20 Jun 2015 22:07:17 +0200 Subject: [PATCH] Allow to disable log capturing during tests #84 --- .../java/com/lambdaworks/CapturingLogAppender.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/lambdaworks/CapturingLogAppender.java b/src/test/java/com/lambdaworks/CapturingLogAppender.java index 26132359cc..0b411ead87 100644 --- a/src/test/java/com/lambdaworks/CapturingLogAppender.java +++ b/src/test/java/com/lambdaworks/CapturingLogAppender.java @@ -12,6 +12,7 @@ public class CapturingLogAppender extends WriterAppender { private static StringWriter writer = new StringWriter(); + private static boolean enabled = true; public CapturingLogAppender() { super(); @@ -27,6 +28,16 @@ public static String getContentAndReset() { @Override public synchronized void doAppend(LoggingEvent event) { - super.doAppend(event); + if (enabled) { + super.doAppend(event); + } + } + + public static void disable() { + enabled = false; + } + + public static void enable() { + enabled = true; } }