title: How to get the Java default logger output to a file?
body: <p>I know how to create log messages in Java that appear in the console: </p>
  
  <pre class="lang-java prettyprint-override"><code>java.util.logging.Logger.getLogger(&lt;CLASSNAME&gt;.class.getName())
   .log(Level.INFO, "LOG MESSAGE");
  </code></pre>
  
  <p>However, I am currently working on a web app (in netbeans IDE). In a web app, it is unfortunately not possible to have the logger output to the console.</p>
  
  <p>Hence, I want to direct output to a file.</p>
  
  <p>A few things I tried, didn't work. For example, I tried the following:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/15758685/how-to-write-logs-in-text-file-when-using-java-util-logging-logger">How to write logs in text file when using java.util.logging.Logger</a></p></li>
  <li><p><a href="https://examples.javacodegeeks.com/core-java/util/logging/java-util-logging-example/" rel="noreferrer">https://examples.javacodegeeks.com/core-java/util/logging/java-util-logging-example/</a></p></li>
  </ul>
  
  <p>...and many others, but nothing seems to work. </p>
  
  <p>How can it be so difficult to direct output to a text file? Does anybody know how to do a direct output of the java default logger to a file?</p>