title: unit testing and logback
body: <p>while testing a piece of code we normally have assertions to check if a variable was set, if a code of block was executed, etc., but we don't normally test if the right log messages are being saved to the log files.</p>
  
  <p>My environment is Java, Spring, Mockito, and Logback. I am thinking of using Mockito and inject the log as a datasource. I looked around and could not find a better idea.</p>
  
  <p>Are you aware of an existing system for testing Logback using the existing logback.xml file and that would also support MDC?</p>
  
  <p>On this specific system, we have two loggers. One of the loggers logs normal events, such as "Entered method A", "did something", "exited method A".</p>
  
  <p>Another log is used for auditing. For example, it stores the parameters that were passed in and out of a specific module. There are reports that run off of this log (using MDC) so the tags used and the values for the tags are important and we would like to verify if the MDC tags contain the values of the parameters. But, as I said, these values should go only to the audit log, and not to the "normal" log, so, beyond testing that the values go to the audit log, we want to test that they DID NOT go to the other log.</p>