title: How to Unit test a message on a Log?
body: <p>I have some code under test that calls on a Java logger to report its status. In the JUnit test code, I would like to confirm that the correct log entry was made in this logger. For example; I have 2 Error Logs for two separate conditions.</p>
  
  <pre><code>methodGoingToBeTested(bool a, bool b){
      if(a)
          logger.info("a happened")
      else()
          logger.info("b happened")
  
  }
  
  @Test tester(){
  
      methodGoingToBeTested(true);
      assertXXXXXX(loggedLevel(),Level.INFO);
  }
  </code></pre>
  
  <p>I would like to test to see if the Logger error's I have up on the actual method generates accurately upon the condition it is meant to generate at. I have checked online but the advice is really old. Does anyone have any suggestions? Your help is appreciated.</p>
  
  <p>I know there is a similar post here but that post is really outdated and the same process can not be used now to solve this problem, which is why I am asking this question in the first place.</p>