title: How to write to OS system log in Java?
body: <p>Mac OS has an application called Console, which contains logged messages, errors, and faults. I believe the Windows equivalent is Event Viewer. I'd imagine there is one on Linux as well, but I don't know anything about it or where it is.</p>
  
  <p>Is it possible to get a message from Java output to a system log like this? I'm writing a GUI-based application, so there is nothing running from the command line. The standard <code>System.out</code> or <code>System.err</code> probably won't be of much use in this case, unless I'm missing something.</p>
  
  <p>I have written a simple logging service for my application that writes to a dedicated log file, but I want to have some kind of failsafe in case an I/O error occurs while attempting to write to this file.</p>
  
  <p>I know the IDE will display output via <code>System.out</code> and <code>System.err</code> just fine, but this is for if the end-user encounters a problem like this.</p>
  
  <p>As an example: I've written "codeless language modules" for the application TextWrangler on the Mac. These modules are read by TW at application startup, and if there is an error while processing them, errors get logged and can be viewed in the Mac Console application.</p>