title: How do I print my output table with 5 parallel arrays from my main class to a .txt file?
body: <p>I am trying to employ a class to print (append) to a .txt file. I have been unsuccessful so far. I am using a simple logger class to output simple Strings, but how can a output to console and also a .txt file?</p>
  <p>Current console output:</p>
  <pre><code>11/18/20 14:09:24
  Current status of all items being tracked:
  Item|             Supply on hand| Last 24 Hr Usage|    Days on hand|          Status|
  -------------------------------------------------------------------------------------
  
  1                               1                1                1         Critical 
  
  Process finished with exit code 0
  </code></pre>
  <p>Main class code in question:</p>
  <pre><code>        //Display all data, collected and calculated
          System.out.println(&quot;Current status of all items being tracked:&quot;);
          System.out.printf(&quot;%-16s %16s %16s %16s %16s&quot;, &quot;Item|&quot;, &quot;Supply on hand|&quot;, &quot;Last 24 Hr Usage|&quot;, &quot;Days on hand|&quot;, &quot;Status|&quot;);
          System.out.println();
          System.out.println(&quot;-------------------------------------------------------------------------------------&quot;);
          System.out.println();
  
          for (int index = 0; index &lt; items.length; index++)
              System.out.printf(&quot;%-16s %16d %16d %16d %16s \n&quot;, items[index], supplyOnHand[index], last24HourUsage[index], daysOnHand[index], status[index]);
  
  Logger.log(&quot;How do I get my table to print here?&quot;);
  </code></pre>
  <p>Logger code:</p>
  <pre><code>    public class Logger {
          public static void log(String message) throws IOException {
              try (PrintWriter out = new PrintWriter(new FileWriter(&quot;output.txt&quot;, true), true)) {
                  out.write(message);
                  out.close();
  </code></pre>
  <p>Current file output:</p>
  <pre><code>How do I get my table to print here?
  </code></pre>