title: Why java.util.logging is not writing logs to file?
body: <p>I have prepared a logger for a class.
  Code is as follows:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class MyClass {
  
      FileHandler handler;
      Logger logger;
  
      // SINGLETON PATTERN
      private static final MyClass SINGLE_INSTANCE = new MyClass();         
      private MyClass() {
  
        try {
          handler = new FileHandler("MyClass.log", false);
          logger = Logger.getLogger(MyClass.class.getName());
          handler.setLevel(Level.ALL);
          logger.setLevel(Level.ALL);
        } catch (IOException ioe) {
          System.err.println("Initialization of logger threw");
          ioe.printStackTrace();
          throw new RuntimeException("Initialization of logger threw", ioe);
        }
  
      }
      public static MyClass getInstance() {
        return SINGLE_INSTANCE;
      }    
  
      public void doStuff() {
  
          Logger.getLogger(MyClass.class.getName()).log(Level.FINE, "Log Text");
  
      }
  
  }
  </code></pre>
  
  <p>To enable the logging for <code>Level.FINE</code> I have invoked method <code>.setLevel</code> both on <code>logger</code> and on <code>handler</code>. But when I execute the code and invoke <code>doStuff()</code> no output appears on the log. </p>
  
  <p>Notes that could be relevant:</p>
  
  <ol>
  <li>The file is there but it has size 0.</li>
  <li>I am stopping the program with CONTROL+C (it is a console application).</li>
  </ol>