title: Logging in Unit Tests for Play 2.3
body: <p>Been struggling to get any logging output in unit tests in Play 2.3 using <code>Logger.error("an error")</code>. I've tried all of <a href="https://stackoverflow.com/questions/11597102/how-to-force-logger-debug-output-in-play-framework-specs2-tests">these examples</a> which seem to be outdated.</p>
  
  <p>The closest I got was with a <code>build.sbt</code> containing the following:</p>
  
  <pre><code>testOptions in Test += Tests.Argument("-Dlogger.resource=conf/test-logger.xml")
  </code></pre>
  
  <p>This causes the <code>test-logger.xml</code> file to configure the logger, but still I do not get output from any tests.</p>
  
  <p>Has anyone had any success with this in Play 2.3?</p>
  
  <p><strong>Temporary Workaround</strong></p>
  
  <p>I'm currently using a quick util class to deal with this until it is fixed. Added here as it may be useful for someone else.</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Logger {
  
      public static void debug(String message) {
          System.out.println(String.format("[debug] %s", message));
      }
  
      public static void info(String message) {
          System.out.println(String.format("[info] %s", message));
      }
  
      public static void warn(String message) {
          System.out.println(String.format("[warn] %s", message));
      }
  
      public static void error(String message) {
          System.err.println(String.format("[error] %s", message));
      }
  }
  </code></pre>