@Override
 @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
 public synchronized String format(final LogRecord record) {
   dat.setTime(record.getMillis());
   String source;
   if (record.getSourceClassName() != null) {
     source = record.getSourceClassName();
     if (record.getSourceMethodName() != null) {
       source += "#" + record.getSourceMethodName();
     }
   } else {
     source = record.getLoggerName();
   }
   String message = formatMessage(record);
   String throwable = "";
   if (record.getThrown() != null) {
     StringWriter sw = new StringWriter();
     PrintWriter pw = new PrintWriter(sw);
     pw.println();
     record.getThrown().printStackTrace(pw);
     pw.close();
     throwable = sw.toString();
   }
   return String.format(
       FORMAT,
       dat,
       source,
       record.getLoggerName(),
       record.getLevel().getLocalizedName(),
       message,
       throwable);
 }
Example #2
0
  /**
   * @param record
   * @param sb
   */
  private void printSourceMethodName(LogRecord record, StringBuffer sb) {
    if (record.getSourceMethodName() != null) {
      sb.append(record.getSourceMethodName());
      sb.append("()");
    }

    sb.append(seperator);
  }
  public void log(LogRecord record) {
    if (logToFile != null) {
      logToFile(record);
    }

    if (ignoreLogging) return;

    CapedwarfRequestLogs requestLogs = getCurrentRequestLogs();
    if (requestLogs != null) {
      CapedwarfAppLogLine capedwarfAppLogLine =
          new CapedwarfAppLogLine(getCurrentRequestId(), record.getSequenceNumber());
      AppLogLine appLogLine = capedwarfAppLogLine.getAppLogLine();
      appLogLine.setLogLevel(getLogLevel(record));
      appLogLine.setLogMessage(
          record.getSourceClassName()
              + " "
              + record.getSourceMethodName()
              + ": "
              + getFormattedMessage(record)
              + "\n");
      appLogLine.setTimeUsec(record.getMillis() * 1000);
      logWriter.put(capedwarfAppLogLine);

      requestLogs.logLineAdded(appLogLine);
      logWriter.put(requestLogs);
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see java.util.logging.Formatter#format(java.util.logging.LogRecord)
   */
  @Override
  public String format(final LogRecord logRecord) {
    //		Date recordDate = new Date(logRecord.getMillis());
    StringBuffer sb = new StringBuffer();
    try {
      // TIME and LEVEL is already at the console
      //			sb.append(LogUtils.dateToString(recordDate, UTC_Format));
      //			sb.append(" [");
      //			sb.append(logRecord.getLevel().getName());
      //			sb.append("]: ");

      //
      sb.append(logRecord.getMessage());

      sb.append("\n   (source:");
      sb.append(logRecord.getSourceClassName());
      sb.append('.');
      sb.append(logRecord.getSourceMethodName());
      if (logRecord.getThrown() != null) {
        sb.append(" - See IBM_TECHNICAL_SUPPORT\\org.openntf.log.X.Y.txt for full stack trace.");
      }
      sb.append(")");
    } catch (Throwable t) {
      System.out.println(
          "Error trying to format output for error handling. Resorting to standard stack trace...");
      t.printStackTrace();
    }
    return sb.toString();
  }
Example #5
0
    /*
     * @see java.util.logging.Formatter#format(java.util.logging.LogRecord)
     */
    @Override
    public String format(final @Nullable LogRecord record) {
      assert record != null;

      final StringBuilder sb = new StringBuilder();
      sb.append(formatMessage(record));
      sb.append(" ["); // $NON-NLS-1$
      if (record.getSourceClassName() != null) {
        sb.append(record.getSourceClassName());
      }
      if (record.getSourceMethodName() != null) {
        sb.append(", "); // $NON-NLS-1$
        sb.append(record.getSourceMethodName());
      }
      sb.append("]"); // $NON-NLS-1$
      return sb.toString();
    }
Example #6
0
 @Override
 public String format(LogRecord record) {
   return String.format(
       "[%1$tF %1$tT %5$s] %2$s [%3$s/%4$s]\n",
       new Date(record.getMillis()),
       record.getMessage(),
       record.getSourceClassName(),
       record.getSourceMethodName(),
       record.getLevel().getName());
 }
 public String format(LogRecord record) {
   StringBuilder builder = new StringBuilder(1000);
   builder.append(df.format(new Date(record.getMillis()))).append(" - ");
   builder.append("[").append(record.getSourceClassName()).append(".");
   builder.append(record.getSourceMethodName()).append("] - ");
   builder.append("[").append(record.getLevel()).append("] - ");
   builder.append(formatMessage(record));
   builder.append("\n");
   return builder.toString();
 }
Example #8
0
  @Override
  public String format(LogRecord record) {

    StringBuilder sb = new StringBuilder();
    sb.append("[" + record.getLevel() + "] - ");
    sb.append(new Date(record.getMillis()) + " : ");
    sb.append(record.getSourceClassName() + "." + record.getSourceMethodName() + " : ");
    sb.append(record.getMessage() + "\n");
    return sb.toString();
  }
Example #9
0
  /**
   * Overrides SimpleFormatter format function. Writes the output without displaying the
   * date/timestamp.
   *
   * @param iRecord The log record that needs formatted.
   * @return A string formatted for a logging message
   */
  public synchronized String format(LogRecord iRecord) {
    StringBuffer sb = new StringBuffer();

    if (iRecord.getSourceClassName() != null) {
      sb.append(iRecord.getSourceClassName());
    } else {
      sb.append(iRecord.getLoggerName());
    }
    if (iRecord.getSourceMethodName() != null) {
      sb.append(" ");
      sb.append(iRecord.getSourceMethodName());
    }
    sb.append(" ");

    String message = formatMessage(iRecord);
    sb.append(iRecord.getLevel().getLocalizedName());
    sb.append(": ");
    sb.append(message);
    sb.append(mLineSeparator);

    return sb.toString();
  }
  @Override
  public String format(LogRecord record) {

    String stackTrace = "";
    Throwable throwable = record.getThrown();
    if (throwable != null) {
      StringWriter sw = new StringWriter();
      throwable.printStackTrace(new PrintWriter(sw));
      stackTrace = sw.toString();
    }

    int lineNo;
    StackTraceElement[] stack = Thread.currentThread().getStackTrace();
    if (throwable != null && stack.length > 7) lineNo = stack[7].getLineNumber();
    else if (stack.length > 8) lineNo = stack[8].getLineNumber();
    else lineNo = -1;

    StringBuffer b = new StringBuffer();
    if (logPolicy.isEnabled(LogPolicy.LOG_POLICY_SHOW_THREAD_ID)) {
      b.append(String.format("%2d", record.getThreadID())).append(" ");
    }
    if (logPolicy.isEnabled(LogPolicy.LOG_POLICY_SHOW_LEVEL)) {
      b.append(record.getLevel().toString()).append(" ");
    }
    if (logPolicy.isEnabled(LogPolicy.LOG_POLICY_SHOW_CLASS)) {
      b.append("[").append(getSimpleClassName(record.getSourceClassName())).append("]: ");
    }
    if (logPolicy.isEnabled(LogPolicy.LOG_POLICY_SHOW_MESSAGE)) {
      b.append(formatMessage(record));
    }
    if (logPolicy.isEnabled(LogPolicy.LOG_POLICY_SHOW_SOURCE)) {
      b.append(" - (")
          .append(record.getSourceClassName())
          .append(".java:")
          .append(lineNo)
          .append(") ");
    }
    if (logPolicy.isEnabled(LogPolicy.LOG_POLICY_SHOW_METHOD)) {
      b.append(record.getSourceMethodName()).append("()");
    }
    if (logPolicy.isEnabled(LogPolicy.LOG_POLICY_SHOW_THREAD)) {
      b.append(" in thread ").append(Thread.currentThread().getName());
    }
    if (logPolicy.dateFormat != null) {
      b.append(" at (")
          .append(logPolicy.dateFormat.format(new Date(record.getMillis())))
          .append(")");
    }
    b.append("\n").append(stackTrace);
    return b.toString();
  }
  @Override
  protected final void format0(LogRecord record, TextBuilder tb) {
    tb.append(record.getLevel()).append(" ");

    appendDateSys(record, tb);

    if (record.getLevel().intValue() > Level.INFO.intValue() || record.getThrown() != null)
      tb.append(record.getSourceClassName())
          .append(".")
          .append(record.getSourceMethodName())
          .append("(): ");

    appendMessage(record, tb);
    appendThrown(record, tb);
  }
Example #12
0
 @Override
 public String format(LogRecord logRecord) {
   final StringBuilder result = new StringBuilder();
   result.append(logRecord.getSequenceNumber());
   result.append('[');
   result.append(logRecord.getLevel());
   result.append("] ");
   result.append(logRecord.getSourceClassName().replace("com.microsoft.reef", "c.m.r"));
   result.append('.');
   result.append(logRecord.getSourceMethodName());
   result.append(": ");
   result.append(simpleFormatter.formatMessage(logRecord));
   result.append('\n');
   return result.toString();
 }
Example #13
0
  // This method is called for every log records
  public String format(LogRecord rec) {
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    PrintStream printStream = new PrintStream(byteArrayOutputStream);

    printStream.format(
        "%-7s %-24s %-80s  %-40s Seq:%d Thread:%d\n",
        rec.getLevel(),
        SIMPLE_DATE_FORMAT.format(new Date(rec.getMillis())),
        rec.getMessage(),
        rec.getSourceClassName() + "." + rec.getSourceMethodName(),
        rec.getSequenceNumber(),
        rec.getThreadID());

    return byteArrayOutputStream.toString();
  }
Example #14
0
 @Override
 public void publish(final LogRecord record) {
   if (record.getLevel().intValue() < this.getLevel().intValue()
       || record.getLoggerName().equals(getClass().getName())) {
     return;
   }
   try {
     Mailer.instance()
         .send(
             (message) -> {
               message.addRecipient(
                   Message.RecipientType.TO,
                   new InternetAddress(
                       "clash.nanobot+log."
                           + record.getLevel().getName().toLowerCase()
                           + "@gmail.com"));
               message.setSubject(record.getLevel() + ": " + record.getMessage());
               String emailBody = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\">";
               emailBody +=
                   "<tr><td>Version</td><td>" + BuildInfo.instance().getVersion() + "</td></tr>";
               emailBody +=
                   "<tr><td>BuildTime</td><td>"
                       + BuildInfo.instance().getTimestamp()
                       + "</td></tr>";
               emailBody += "<tr><td>Time</td><td>" + record.getMillis() + "</td></tr>";
               emailBody += "<tr><td>Thread</td><td>" + record.getThreadID() + "</td></tr>";
               emailBody += "<tr><td>Logger</td><td>" + record.getLoggerName() + "</td></tr>";
               emailBody += "<tr><td>Class</td><td>" + record.getSourceClassName() + "</td></tr>";
               emailBody +=
                   "<tr><td>Method</td><td>" + record.getSourceMethodName() + "</td></tr>";
               emailBody += "<tr><td>Level</td><td>" + record.getLevel() + "</td></tr>";
               emailBody += "<tr><td>Message</td><td>" + record.getMessage() + "</td></tr>";
               final Throwable e = record.getThrown();
               if (e != null) {
                 final StringWriter writer = new StringWriter();
                 e.printStackTrace(new PrintWriter(writer));
                 emailBody +=
                     "<tr><td>Exception</td><td>"
                         + writer.toString().replace("\n", "<br/>")
                         + "</td></tr>";
               }
               emailBody += "</table>";
               message.setContent(emailBody, "text/html");
             });
   } catch (final Exception e) {
     logger.log(Level.SEVERE, e.getMessage(), e);
   }
 }
  public void publish(LogRecord record, int nLogType) {
    // first see if this entry should be filtered out
    try {
      if (record != null) {

        // MARKED by zhaoxy@20101119
        /*
           if (getFilter() != null) {
        	if (!getFilter().isLoggable(record))
        		return;
        }
        */

        if (isLoggable(record)) {
          String HmuImei = null;
          String Message = record.getMessage();
          try {
            int HmuImeiPos = Message.indexOf("HMU:");
            if (HmuImeiPos >= 0) {
              HmuImei = Message.substring(HmuImeiPos + 4);
              Message = Message.substring(0, HmuImeiPos);
            }
          } catch (Exception e) {
          }

          // now store the log entry into the table
          if (activeConnection()) {
            try {
              prepInsert.setInt(1, record.getLevel().intValue());
              prepInsert.setString(2, truncate(record.getLoggerName(), 63));
              prepInsert.setString(3, truncate(Message, 255));
              prepInsert.setLong(4, record.getSequenceNumber());
              prepInsert.setString(5, truncate(record.getSourceClassName(), 63));
              prepInsert.setString(6, truncate(record.getSourceMethodName(), 31));
              prepInsert.setInt(7, record.getThreadID());
              prepInsert.setTimestamp(8, new Timestamp(System.currentTimeMillis()));
              prepInsert.setString(9, truncate(HmuImei, 15));
              prepInsert.setInt(10, nLogType);
              prepInsert.executeUpdate();
            } catch (SQLException e) {
              System.err.println("Exception on publish(record,nLogType)." + e);
            }
          }
        }
      }
    } catch (Exception e) {
    }
  }
Example #16
0
 @Override
 public String format(LogRecord rec) {
   StringWriter w1 = new StringWriter();
   PrintWriter w2 = new PrintWriter(w1);
   w2.printf(
       messageFormat,
       dateFormat.format(new Date(rec.getMillis())),
       rec.getThreadID(),
       String.valueOf(rec.getLevel()),
       fixClsName(rec.getSourceClassName()),
       fixMtdName(rec.getSourceMethodName()),
       rec.getMessage());
   w2.println();
   w2.close();
   return w1.toString();
 }
Example #17
0
 @Override
 public String format(final LogRecord record) {
   final StringBuilder logEntry = new StringBuilder();
   final Calendar cal = Calendar.getInstance();
   cal.setTimeInMillis(record.getMillis());
   logEntry.append(DateHelper.formatDate(cal));
   logEntry.append(" [");
   logEntry.append(record.getThreadID());
   logEntry.append("] ");
   logEntry.append(record.getLevel().getName());
   logEntry.append(" ");
   logEntry.append(record.getSourceClassName());
   logEntry.append(" ");
   logEntry.append(record.getSourceMethodName());
   logEntry.append(" - ");
   logEntry.append(record.getMessage());
   logEntry.append("\n");
   return logEntry.toString();
 }
Example #18
0
 public String format(LogRecord record) {
   StringBuilder sb = new StringBuilder();
   sb.append(max5(record.getLevel().getName()));
   sb.append(" ");
   String s = record.getSourceClassName();
   int len = s.length();
   if (len > 60) {
     sb.append("...");
     sb.append(s.substring(len - 58, len));
   } else sb.append(s);
   sb.append(" ");
   sb.append(record.getSourceMethodName());
   sb.append(" ");
   while (sb.length() < 90) sb.append(".");
   sb.append(" ");
   sb.append(record.getMessage());
   sb.append("\n");
   return sb.toString();
 }
  @Override
  public String format(LogRecord record) throws RemoteException, RemoteException {
    StringBuilder sb = new StringBuilder();

    // Timestamp
    addTimestamp(sb, record.getMillis());

    // Severity
    sb.append(' ');
    sb.append(record.getLevel());

    // Thread
    sb.append(' ');
    sb.append('[');
    sb.append(Thread.currentThread().getName());
    sb.append(']');

    // Source
    sb.append(' ');
    sb.append(record.getSourceClassName());
    sb.append('.');
    sb.append(record.getSourceMethodName());

    // Message
    sb.append(' ');
    sb.append(formatMessage(record));

    // Stack trace
    if (record.getThrown() != null) {
      sb.append(ST_SEP);
      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      record.getThrown().printStackTrace(pw);
      pw.close();
      sb.append(sw.getBuffer());
    }

    // New line for next record
    sb.append(LINE_SEP);

    return sb.toString();
  }
 @Override
 public String format(LogRecord logRecord) {
   Object[] arguments = new Object[6];
   arguments[0] = logRecord.getThreadID();
   String fullClassName = logRecord.getSourceClassName();
   int lastDot = fullClassName.lastIndexOf('.');
   String className = fullClassName.substring(lastDot + 1);
   arguments[1] = className;
   arguments[2] = logRecord.getSourceMethodName();
   arguments[3] = new Date(logRecord.getMillis());
   arguments[4] = logRecord.getMessage();
   if (logRecord.getThrown() != null) {
     Writer result = new StringWriter();
     logRecord.getThrown().printStackTrace(new PrintWriter(result));
     arguments[5] = result.toString();
   } else {
     arguments[5] = "";
   }
   return messageFormat.format(arguments);
 }
  protected void appendPrefix(LogRecord record, StringBuilder prefix) {
    String levelName = record.getLevel().getName();
    String padding = BLANKS.substring(0, MAX_LEVEL_LENGTH - levelName.length());
    prefix.append(padding).append(levelName).append(": ");

    String loggerName = record.getLoggerName();
    if (loggerName != null) {
      prefix.append(Thread.currentThread().getName()).append(" - ");

      String loggerShortName = loggerName.substring(loggerName.lastIndexOf('.') + 1);
      prefix.append(loggerShortName);

      String methodName = record.getSourceMethodName();
      if (methodName != null) {
        prefix.append("." + methodName);
      }

      prefix.append(": ");
    }
  }
Example #22
0
  /* (non-Javadoc)
   * @see java.util.logging.Formatter#format(java.util.logging.LogRecord)
   */
  @Override
  public String format(LogRecord record) {
    StringBuffer sb = new StringBuffer();
    sb.append("<tr>");

    sb.append("<td>");
    sb.append(dateToString(new Date(record.getMillis()), "yyyy/MM/dd"));
    sb.append("</td>");

    sb.append("<td>");
    sb.append(dateToString(new Date(record.getMillis()), "hh:mm:ss,SSS"));
    sb.append("</td>");

    sb.append("<td>");
    if (record.getParameters() != null) {
      sb.append(record.getParameters()[0]);
    } else {
      sb.append(record.getThreadID());
    }
    sb.append("</td>");

    sb.append("<td>");
    sb.append(record.getSourceClassName());
    sb.append("</td>");

    sb.append("<td>");
    sb.append(record.getSourceMethodName());
    sb.append("</td>");

    sb.append("<td>");
    sb.append(record.getLevel());
    sb.append("</td>");

    sb.append("<td>");
    sb.append(formatMessage(record));
    sb.append("</td>");

    sb.append("</tr>");

    return sb.toString();
  }
  /**
   * Accumulates log records which will be used to produce the final output. The output is generated
   * using the {@link #getTail} method which also resets this formatter back to its original state.
   *
   * @param record the record to store.
   * @return an empty string.
   * @throws NullPointerException if the given record is null.
   */
  @Override
  public String format(final LogRecord record) {
    if (record == null) {
      throw new NullPointerException();
    }

    boolean accepted;
    do {
      final LogRecord peek = peek();
      // The self compare of the first record acts like a type check.
      LogRecord update = apply(peek != null ? peek : record, record);
      if (peek != update) { // Not identical.
        update.getSourceMethodName(); // Infer caller.
        accepted = acceptAndUpdate(peek, update);
      } else {
        accepted = true;
        accept(record);
      }
    } while (!accepted);
    return "";
  }
Example #24
0
  @Override
  public String format(LogRecord r) {

    Date date = new Date(r.getMillis());
    String[] srcPkg =
        r.getSourceClassName()
            .split("\\."); // Won't work properly for sub-classes.  Who the f**k cares?

    return (date.toString()
        + "["
        + r.getLoggerName()
        + "]["
        + srcPkg[srcPkg.length - 1]
        + ":"
        + r.getSourceMethodName()
        + "]["
        + r.getLevel()
        + "]"
        + r.getMessage()
        + "\n");
  }
Example #25
0
 /* (non-Javadoc)
  * @see java.util.logging.Formatter#format(java.util.logging.LogRecord)
  */
 @Override
 public String format(LogRecord record) {
   try {
     String result = formatMessage(record);
     try {
       String sourceClassName = record.getSourceClassName();
       String sourceMethodName = record.getSourceMethodName();
       result =
           record.getLevel().getLocalizedName()
               + ": "
               + result
               + " ["
               + (sourceClassName != null ? sourceClassName : "??")
               + "#"
               + (sourceMethodName != null ? sourceMethodName : "??")
               + "]\n";
     } catch (Throwable t) {
       result = "Error formatting log message \"" + result + "\": " + t.getLocalizedMessage();
     }
     return result;
   } catch (Throwable t) {
     return "Error formatting log record: " + t.getLocalizedMessage();
   }
 }
Example #26
0
  @SuppressWarnings("unchecked")
  public String format(final LogRecord record) {
    // Reset working buffer. If the buffer is too large, then we need a new
    // one in order to avoid the penalty of creating a large array.
    if (buf.capacity() > UPPER_LIMIT) {
      buf = new StringBuffer(DEFAULT_SIZE);
    } else {
      buf.setLength(0);
    }
    buf.append("<log4j:event logger=\"");
    buf.append(Transform.escapeTags(record.getLoggerName()));
    buf.append("\" timestamp=\"");
    buf.append(record.getMillis());
    buf.append("\" level=\"");

    buf.append(Transform.escapeTags(record.getLevel().getName()));
    buf.append("\" thread=\"");
    buf.append(String.valueOf(record.getThreadID()));
    buf.append("\">\r\n");

    buf.append("<log4j:message><![CDATA[");
    // Append the rendered message. Also make sure to escape any
    // existing CDATA sections.
    Transform.appendEscapingCDATA(buf, record.getMessage());
    buf.append("]]></log4j:message>\r\n");

    if (record.getThrown() != null) {
      String[] s = Transform.getThrowableStrRep(record.getThrown());
      if (s != null) {
        buf.append("<log4j:throwable><![CDATA[");
        for (String value : s) {
          Transform.appendEscapingCDATA(buf, value);
          buf.append("\r\n");
        }
        buf.append("]]></log4j:throwable>\r\n");
      }
    }

    if (locationInfo) {
      buf.append("<log4j:locationInfo class=\"");
      buf.append(Transform.escapeTags(record.getSourceClassName()));
      buf.append("\" method=\"");
      buf.append(Transform.escapeTags(record.getSourceMethodName()));
      buf.append("\" file=\"?\" line=\"?\"/>\r\n");
    }

    if (properties) {
      if (MDC.getMDCAdapter() instanceof BasicMDCAdapter) {
        BasicMDCAdapter mdcAdapter = (BasicMDCAdapter) MDC.getMDCAdapter();
        Set keySet = mdcAdapter.getKeys();
        if (keySet != null && keySet.size() > 0) {
          buf.append("<log4j:properties>\r\n");
          Object[] keys = keySet.toArray();
          Arrays.sort(keys);
          for (Object key1 : keys) {
            String key = key1.toString();
            Object val = mdcAdapter.get(key);
            if (val != null) {
              buf.append("<log4j:data name=\"");
              buf.append(Transform.escapeTags(key));
              buf.append("\" value=\"");
              buf.append(Transform.escapeTags(String.valueOf(val)));
              buf.append("\"/>\r\n");
            }
          }
          buf.append("</log4j:properties>\r\n");
        }
      }
    }
    buf.append("</log4j:event>\r\n\r\n");

    return buf.toString();
  }
Example #27
0
  /**
   * Publish
   *
   * @see java.util.logging.Handler#publish(java.util.logging.LogRecord)
   * @param record log record
   */
  public void publish(LogRecord record) {
    checkContext();

    LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
    if (!isLoggable(record) || m_logs == null) return;

    //	Output
    synchronized (m_logs) {
      if (m_logs.size() >= LOG_SIZE) m_logs.removeFirst();
      m_logs.add(record);
    }

    //	We have an error
    if (record.getLevel() == Level.SEVERE) {
      LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
      LinkedList<LogRecord[]> m_history = (LinkedList<LogRecord[]>) Env.getCtx().get(HISTORY_KEY);
      if (m_errors.size() >= ERROR_SIZE) {
        m_errors.removeFirst();
        m_history.removeFirst();
      }
      //	Add Error
      m_errors.add(record);
      record.getSourceClassName(); // 	forces Class Name eval

      //	Create History
      ArrayList<LogRecord> history = new ArrayList<LogRecord>();
      for (int i = m_logs.size() - 1; i >= 0; i--) {
        LogRecord rec = (LogRecord) m_logs.get(i);
        if (rec.getLevel() == Level.SEVERE) {
          if (history.size() == 0) history.add(rec);
          else break; // 	don't include previous error
        } else {
          history.add(rec);
          if (history.size() > 10) break; // 	no more then 10 history records
        }
      }
      LogRecord[] historyArray = new LogRecord[history.size()];
      int no = 0;
      for (int i = history.size() - 1; i >= 0; i--) historyArray[no++] = (LogRecord) history.get(i);
      m_history.add(historyArray);
      //	Issue Reporting
      if (isIssueError()) {
        String loggerName = record.getLoggerName(); // 	class name
        if (loggerName == null) loggerName = "";
        String className = record.getSourceClassName(); // 	physical class
        String methodName = record.getSourceMethodName(); //
        if (DB.isConnected(false)
            && !methodName.equals("saveError")
            && !methodName.equals("get_Value")
            && !methodName.equals("dataSave")
            && loggerName.indexOf("Issue") == -1
            && loggerName.indexOf("CConnection") == -1) {
          setIssueError(false);
          try {
            MIssue.create(record);
            setIssueError(true);
          } catch (Throwable e) {
            // failed to save exception to db, print to console
            System.err.println(getFormatter().format(record));
            setIssueError(false);
          }
        } else {
          // display to user if database connection not available
          if (!methodName.equals("saveError")
              && !methodName.equals("get_Value")
              && !methodName.equals("dataSave")
              && loggerName.indexOf("Issue") == -1
              && loggerName.indexOf("CConnection") == -1) {
            System.err.println(getFormatter().format(record));
          }
        }
      }
    }
  } // publish