log.error(e.toString());
log.error("Exception", e);
  public static void main(String[] args) {    ConsoleStyledDocument doc = new ConsoleStyledDocument();    AttributeSet a = new javax.swing.text.SimpleAttributeSet();    Logger log = CSMART.createLogger("org.cougaar.tools.csmart.ui.console.ConsoleStyledDocument");    // with MAX_CHARACTER = 5 this prints:    // abc, abcde, fghij, vwxyz    doc.setBufferSize(5);    try {      BufferedWriter logFile = new BufferedWriter(new FileWriter("tmp"));      logFile.write("abc");      doc.appendString("abc", a);      if(log.isDebugEnabled()) {        log.debug(doc.getText(0, doc.getLength()));      }      logFile.write("de");      doc.appendString("de", a);      if(log.isDebugEnabled()) {        log.debug(doc.getText(0, doc.getLength()));      }      logFile.write("fghij");      doc.appendString("fghij", a);      if(log.isDebugEnabled()) {        log.debug(doc.getText(0, doc.getLength()));      }      logFile.write("klmnopqrstuvwxyz");      doc.appendString("klmnopqrstuvwxyz", a);      if(log.isDebugEnabled()) {        log.debug(doc.getText(0, doc.getLength()));      }      logFile.close();      doc.fillFromLogFile("tmp");      if(log.isDebugEnabled()) {        log.debug(doc.getText(0, doc.getLength()));      }      logFile = new BufferedWriter(new FileWriter("tmp", true));      logFile.write("12345");      doc.appendString("12345", a);      if(log.isDebugEnabled()) {        log.debug("Final document");        log.debug(doc.getText(0, doc.getLength()));      }      logFile.close();    } catch (Exception e) {      if(log.isErrorEnabled()) {        log.error(e.toString());      }    }  }