title: How to use java.util.logging.Logger from different threads?
body: <p>I am developing a simple swing application with a <code>JTextArea</code> to show log messages from the entire application. In order to develop this application, I am using a simplified version of the <em>MVC</em> pattern, in which the controller is interposed between the view and the model in both directions:</p>
  
  <ul>
  <li>when the user interacts with a swing control, if this interaction requires access to the model (that is, it requires reading and/or writing the model), then the event raised by the swing control calls for an appropriate method of controller;</li>
  <li>when the view should be updated, the controller invokes one or more methods of the view.</li>
  </ul>
  
  <p>Almost all exceptions are caught in the controller and sent to the <code>java.util.logging.Logger</code>, as in the following code snippet.</p>
  
  <pre><code>public void onWriteFile() {
      try {
          // ...
      }
      catch(IOException ex) {
          Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, "onWriteFile()", ex);
      }
  
      view.refresh(...);
  }
  </code></pre>
  
  <p>Only the following exception is caught inside a custom graphical component and is sent to the logger (I took inspiration from the example in <em>Listing 6. Robust listener invocation</em> of <a href="http://www.ibm.com/developerworks/library/j-jtp07265/" rel="nofollow noreferrer">Java theory and practice: Be a good (event) listener</a>).</p>
  
  <pre><code>private synchronized void processDrawingEvent(DrawingEvent e) {
      if (e == null) {
          return;
      }
  
      for (Iterator&lt;DrawingListener&gt; i = listeners.iterator(); i.hasNext();) {
          DrawingListener listener = i.next();
          try {
              switch (e.getStatus()) {
                  case DRAWING:
                      listener.drawing(e);
                      break;
                  case DONE:
                      listener.done(e);
                      break;
                  case DELETED:
                      listener.deleted(e);
                      break;
                  }
          } catch (RuntimeException ex) {
              i.remove();
              Logger.getLogger(ImagePanel.class.getName()).log(Level.SEVERE, null, ex);
          }
      }
  }
  </code></pre>
  
  <p>Currently all calls to the <code>Logger.log(...)</code> method are coming from the same thread. However, if this method was invoked by different threads, should I use a solution like <a href="https://stackoverflow.com/a/27409673/364056">this</a>?</p>