Skip to content

Commit

Permalink
Allow to disable log capturing during tests #84
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Jun 20, 2015
1 parent 14ee198 commit 5abd96f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/test/java/com/lambdaworks/CapturingLogAppender.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
public class CapturingLogAppender extends WriterAppender {

private static StringWriter writer = new StringWriter();
private static boolean enabled = true;

public CapturingLogAppender() {
super();
Expand All @@ -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;
}
}

0 comments on commit 5abd96f

Please sign in to comment.