title: JUnit error testing and logging
body: <p>I am testing in a JUnit test that a custom error is raised in certain cases, with an @Test annotation, and everything goes well.</p>
  
  <pre><code> @Test(expected = MyCustomException.class)
   public void MyTest(){
      ...
   }
  </code></pre>
  
  <p>However, in my code, when I have such an error, I use a logger (slf4j) in such a way : </p>
  
  <pre><code>catch (IllegalArgumentException e) {
          LOG.error("My custom exception occured with {}", inputVar, e);
          throw new MyCustomException(inputVar, e);
      }
  </code></pre>
  
  <p>So far, the behavior is good. When I build my application with maven, all the tests are done. 
  When the described test is done, the test is marked as passed, but I have a full stacktrace in my shell with a big ERROR in front of it.</p>
  
  <p>My question is the following, is there a way to remove the logs when I run the tests (and therefore not to see it in the shell)?</p>
  
  <p>The second question is : Should I even try to? Or should I just verify that all the tests passed, and not worry about a stack trace and an error when I see one while building my application? (changing my mind instead of changing the code)</p>