package net.kencochrane.raven.log4j2;

import mockit.Mock;
import mockit.MockUp;
import org.apache.logging.log4j.core.ErrorHandler;
import org.apache.logging.log4j.core.LogEvent;

public class MockUpErrorHandler extends MockUp<ErrorHandler> {
    private int errorCount = 0;

    @Mock
    public void error(String msg) {
        errorCount++;
    }

    @Mock
    public void error(String msg, Throwable t) {
        errorCount++;
    }

    @Mock
    public void error(String msg, LogEvent event, Throwable t) {
        errorCount++;
    }

    public int getErrorCount() {
        return errorCount;
    }
}

@@ -329,38 +329,71 @@
   errorCount++;%0A
+        System.err.println(msg);%0A
     %7D%0A
-
 %0A    @Mock%0A    p
@@ -450,32 +450,104 @@
   errorCount++;%0A
+        System.err.println(msg);%0A        t.printStackTrace(System.err);%0A
     %7D%0A%0A    @Mock
@@ -604,32 +604,32 @@
  Throwable t) %7B%0A
-
         errorCou
@@ -630,24 +630,97 @@
 rorCount++;%0A
+        System.err.println(msg);%0A        t.printStackTrace(System.err);%0A%0A
     %7D%0A%0A    p

Print errors with MockUpErrorHandler