Update the log summary. Triggered by logging of an exception/incident
via {@link #logSummary(boolean)}, or by daily log rolling {@link #rollLogs()}

@param incidents Thread-safe list that should be used to write summary contents
12103
private void logSummary(final List<IncidentImpl> incidents) {
        if (incidents.isEmpty())
            return;

        // summaryFile can be replaced so hold on to a local copy
        File outFile = summaryFile;

        if (outFile == null) {
            outFile = summaryFile = createNewSummaryFile();
        }

        // outFile can still be null, the create above can still fail
        if (outFile != null) {
            synchronized (outFile) {
                OutputStream os = null;
                try {
                    os = createSummaryStream(outFile);
                    new IncidentSummaryLogger().logIncidentSummary(os, incidents);
                } catch (FileNotFoundException e) {
                    // This is FFDC not being able to find itself... we're in bad
                    // shape if this doesn't work.. 
                    e.printStackTrace();
                } catch (IOException e) {
                } finally {
                    LoggingFileUtils.tryToClose(os);
                }
            }
        }
    }
76534
@PrePersist
    @PreUpdate
    final void updateStats() {
        if (!this.modified || this.statisticalSummary == null) {
            return;
        }

        // Update statistic values
        this.count = (int) this.statisticalSummary.getN();
        this.sum = this.statisticalSummary.getSum();
        this.sumsq = this.statisticalSummary.getSumsq();
        this.mean = this.statisticalSummary.getMean();
        this.standardDeviation = this.statisticalSummary.getStandardDeviation();
        this.variance = this.statisticalSummary.getVariance();
        this.populationVariance = this.statisticalSummary.getPopulationVariance();
        this.max = this.statisticalSummary.getMax();
        this.min = this.statisticalSummary.getMin();
        this.geometricMean = this.statisticalSummary.getGeometricMean();
        this.sumOfLogs = this.statisticalSummary.getSumOfLogs();
        this.secondMoment = this.statisticalSummary.getSecondMoment();

        this.modified = false;
    }
1120869
public void setErrors(java.util.Collection<ErrorDetail> errors) {
        if (errors == null) {
            this.errors = null;
            return;
        }

        this.errors = new java.util.ArrayList<ErrorDetail>(errors);
    }
1108381
public static void handleException(Logger log, Throwable throwable,
            String methodName, Object... params) {
        if (params.length > 0)
            JMLog.errorForException(log, throwable, methodName, params);
        else
            JMLog.errorForException(log, throwable, methodName);
        increaseErrorCount();
        recordErrorMessageHistory(throwable);
    }
837523
public static void logReducedStackTrace(Logger logger, Exception exception) {
		Exception here = new Exception();
		String[] hereStrings = getStackFrames(here);
		String[] throwableStrings = getStackFrames(exception);
		
		int linesToSkip = 1;
		while (throwableStrings.length - linesToSkip > 0 && hereStrings.length - linesToSkip > 0) {
			if (!StringUtils.equals(hereStrings[hereStrings.length-linesToSkip], throwableStrings[throwableStrings.length-linesToSkip])) {
				break;
			}
			linesToSkip++;
		}
		for (int i = 0; i<=throwableStrings.length-linesToSkip; i++) {
			logger.log(Level.SEVERE, throwableStrings[i]);
		}
	}
24945
public void addTraces(List<LogTrace<E>> traces) throws ParameterException {
                Validate.notNull(traces);
                for (LogTrace<E> trace : traces) {
                        addTrace(trace);
                }
        }
786212
public void logDescription(String description) throws IOException
   {
      // The ThreadLocal has been initialized so we know that we are in multithreaded mode.
      if (reportContext.get() != null)
      {
         reportContext.get().addComment(description);
      }
      else
      {
         writeMessage(description);
      }
   }
516832
public void addTrace(LogTrace<E> trace) throws ParameterException {
                Validate.notNull(trace);
                trace.setCaseNumber(traces.size() + 1);
                traces.add(trace);
                summary.addTrace(trace);
                if (!distinctTraces.add(trace)) {
                        for (LogTrace<E> storedTrace : traces) {
                                if (storedTrace.equals(trace)) {
                                        storedTrace.addSimilarInstance(trace.getCaseNumber());
                                        trace.addSimilarInstance(storedTrace.getCaseNumber());
                                }
                        }
                }
        }
1281992
protected void updateTranLogServiceData() throws Exception {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "updateTranLogServiceData");

        try {
            //
            // Check we have a recoverableUnit and three sections to add the data.
            // On recovery we check that all service data sections were recovered.
            //
            if (_tranlogServiceData == null) {
                _tranlogServiceData = _tranLog.createRecoverableUnit();
                _tranlogServerSection = _tranlogServiceData.createSection(TransactionImpl.SERVER_DATA_SECTION, true);
                _tranlogApplIdSection = _tranlogServiceData.createSection(TransactionImpl.APPLID_DATA_SECTION, true);
                _tranlogEpochSection = _tranlogServiceData.createSection(TransactionImpl.EPOCH_DATA_SECTION, true);
                // Log this server name
                _tranlogServerSection.addData(Utils.byteArray(_failureScopeController.serverName()));
                // Log our ApplId
                _tranlogApplIdSection.addData(_ourApplId);
            }

            // Always update this server's current epoch
            _tranlogEpochSection.addData(Util.intToBytes(_ourEpoch));
            _tranlogServiceData.forceSections();
        } catch (Exception e) {
            FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RecoveryManager.updateTranLogSeviceData", "1130", this);
            if (tc.isEntryEnabled())
                Tr.exit(tc, "updateTranLogServiceData", e);
            throw e;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "updateTranLogServiceData");
    }
326477
protected void updateReportSet(ReportSet value, String xmlTag, Counter counter, Element element)
   {
      Element root = element;
      Counter innerCount = new Counter(counter.getDepth() + 1);
      findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), "default");
      findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration());
      findAndReplaceSimpleElement(innerCount, root, "inherited", value.getInherited(), null);
      findAndReplaceSimpleLists(innerCount, root, value.getReports(), "reports", "report");
   }
164319
private void processUncaughtException(Thread thread, Throwable throwable) {
        if (exceptionPurger != null) {
            throwable = exceptionPurger.purge(throwable);
        }
        logException(thread, throwable);
        notifyUserAboutException(thread, throwable);
    }
689163
private void logFailure(String message, Object... args) {
        totalFailures.inc();

        long total = totalFailures.get();

        // it can happen that 2 threads at the same conclude that the level should be warn because of the
        // non atomic int/get. This is an acceptable trade of since it is unlikely to happen and you only get
        // additional warning under log as a side effect.
        Level level = total % WARNING_LOG_FREQUENCY == 0
                ? Level.WARNING : Level.FINEST;

        if (logger.isLoggable(level)) {
            logger.log(level, String.format(message, args));
        }
    }
692065
public void updateLogFiles(BaseMessage messageResponseIn, boolean bSuccess)
    {
        TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageResponseIn.getMessageHeader();
        String strOrigTrxID = (String)trxMessageHeader.get(TrxMessageHeader.ORIG_LOG_TRX_ID);
        String strMessageLogID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID);
        Record recMessageLog = (Record)this.getMessageLog(strOrigTrxID);
        if ((recMessageLog != null)
            && ((recMessageLog.getEditMode() == DBConstants.EDIT_CURRENT)
                || (recMessageLog.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))
        {
            try {
                // First update the log of my sent message
                recMessageLog.edit();
                ReferenceField fldReference = (ReferenceField)recMessageLog.getField(MessageLogModel.MESSAGE_STATUS_ID);
                if ((fldReference.isNull()) || (!MessageStatusModel.ERROR.equalsIgnoreCase(fldReference.getReference().getField(MessageStatusModel.CODE).toString())))
                {   // Can't change error status to something else
                    int iMessageStatusID = fldReference.getIDFromCode(MessageStatusModel.SENTOK);
                    if (!bSuccess)
                        iMessageStatusID = fldReference.getIDFromCode(MessageStatusModel.IGNORED);
                    fldReference.setValue(iMessageStatusID);  // Message status
                }
                recMessageLog.getField(MessageLogModel.RESPONSE_MESSAGE_LOG_ID).setString(strMessageLogID);
                recMessageLog.set();
                // Now update the log of this message.
                String strOrigContact = recMessageLog.getField(MessageLogModel.CONTACT_ID).toString();
                String strOrigContactType = recMessageLog.getField(MessageLogModel.CONTACT_ID).toString();
                String strReferenceType = recMessageLog.getField(MessageLogModel.REFERENCE_TYPE).toString();
                String strReferenceID = recMessageLog.getField(MessageLogModel.REFERENCE_ID).toString();
                recMessageLog = (Record)this.getMessageLog(strMessageLogID);
                if ((recMessageLog != null)
                        && ((recMessageLog.getEditMode() == DBConstants.EDIT_CURRENT)
                            || (recMessageLog.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))
                {
                    recMessageLog.edit();
                    recMessageLog.getField(MessageLogModel.RESPONSE_MESSAGE_LOG_ID).setString(strOrigTrxID);
                    if ((strOrigContact != null) && (recMessageLog.getField(MessageLogModel.CONTACT_ID).isNull()))
                        recMessageLog.getField(MessageLogModel.CONTACT_ID).setString(strOrigContact);
                    if ((strOrigContactType != null) && (recMessageLog.getField(MessageLogModel.CONTACT_TYPE_ID).isNull()))
                        recMessageLog.getField(MessageLogModel.CONTACT_TYPE_ID).setString(strOrigContactType);
                    if ((strReferenceType != null) && (recMessageLog.getField(MessageLogModel.REFERENCE_TYPE).isNull()))
                        recMessageLog.getField(MessageLogModel.REFERENCE_TYPE).setString(strReferenceType);
                    if ((strReferenceID != null) && (recMessageLog.getField(MessageLogModel.REFERENCE_ID).isNull()))
                        recMessageLog.getField(MessageLogModel.REFERENCE_ID).setString(strReferenceID);
                    recMessageLog.set();
                }
            } catch (DBException ex) {
                ex.printStackTrace();
            }
        }
    }
891737
@Override
  public void onNodesUpdated(final List<NodeReport> nodeReports) {
    for (final NodeReport nodeReport : nodeReports) {
      this.nodeIdToRackName.put(nodeReport.getNodeId().toString(), nodeReport.getRackName());
      this.onNodeReport(nodeReport);
    }
  }
711137
protected void updateReporting(Reporting value, String xmlTag, Counter counter, Element element)
   {
      boolean shouldExist = value != null;
      Element root = updateElement(counter, element, xmlTag, shouldExist);
      if (shouldExist)
      {
         Counter innerCount = new Counter(counter.getDepth() + 1);
         findAndReplaceSimpleElement(innerCount, root, "excludeDefaults",
                  (value.isExcludeDefaults() == false) ? null : String.valueOf(value.isExcludeDefaults()), "false");
         findAndReplaceSimpleElement(innerCount, root, "outputDirectory", value.getOutputDirectory(), null);
         iterateReportPlugin(innerCount, root, value.getPlugins(), "plugins", "plugin");
      }
   }
83016
public void logError(Object[] message,Throwable throwable)
    {
        this.log(LogLevel.ERROR,message,throwable);
    }
754261
@Override
  protected void subAppend(LoggingEvent event) {
    super.subAppend(event);
    // That should've gone into our writer. Notify the LogContext.
    String logOutput = writer.toString();
    writer.reset();

    OperationLog log = operationManager.getOperationLogByThread();
    if (log == null) {
      LOG.debug(" ---+++=== Dropped log event from thread " + event.getThreadName());
      return;
    }
    log.writeOperationLog(logOutput);
  }