Example #1
0
 /**
  * Logs a "Remark" event, and allows to specify custom <i>RunId</i> and <i>RuntimeId</i>. For more
  * details about the <i>Product</i>, <i>Process</i>, <i>RunId</i> and <i>RuntimeId</i>
  * identifiers, read the {@link LogCenterDbFlat} overview.
  *
  * @param csChannel The name of the channel where the event is to be sent. If left <i>null</i> the
  *     event is broadcasted to all open channels.
  * @param csProcess The name of the process where the "Remark" has been done. If left <i>null</i>
  *     the {@link LogCenter} accepting the event will assume the remark is coming from its channel
  *     default process. To set the default process of a channel use {@link Log#setProcess}.
  * @param csProduct The name of the product (brand, client, source, etc.) to which the remark
  *     refers. If left <i>null</i> the {@link LogCenter} accepting the event will assume the event
  *     refers to its channel default product. To set the default product of a channel use {@link
  *     Log#setProduct}.
  * @param csName The desired name of the event. If left <i>null</i>, the default value is the
  *     event class name: <i>jlib.log.stdEvents.EventXXX</i>.
  * @param csRunId The run identifier to stamp the event with. If left <i>null</i> the {@link
  *     LogCenter} will use the its current <i>RunId</i> identifier. To set the <i>RunId</i>
  *     identifier for a channel use {@link Log#setRunId}.
  * @param csRuntimeId The execution identifier to stamp the event with. If left <i>null</i> the
  *     {@link LogCenter} will use the its current <i>RuntimeId</i> identifier. To set the
  *     <i>RuntimeId</i> identifier for a channel use {@link Log#setRuntimeId}.
  * @param csRemark An additional free text message.
  */
 public static void log(
     String csChannel,
     String csProcess,
     String csProduct,
     String csName,
     String csRunId,
     String csRuntimeId,
     String csRemark) {
   EventRemark e = new EventRemark(csProcess, csProduct, csName);
   Log.log(csChannel, e, csRemark, csRunId, csRuntimeId);
 }
Example #2
0
  private boolean dumpJSonClass(Class programClass, Object oSource) {
    Field fieldlist[] = programClass.getDeclaredFields();
    for (int i = 0; i < fieldlist.length; i++) {
      Field fld = fieldlist[i];
      fld.setAccessible(true);
      String csName = fld.getName();
      Class type = fld.getType();
      int iMod = fld.getModifiers();
      if (Modifier.isStatic(iMod)) continue;
      String csTypeName = type.getName();
      try {
        if (m_nNbItemSet > 0) // Terminates previous line is there was one
        endCurrentLine(m_sbOut);
        beginNewLine(m_sbOut);

        // remove prefix membership
        if (csName.startsWith("m_")) csName = csName.substring(2);
        else if (csName.startsWith("_")) csName = csName.substring(1);

        m_sbOut.append("\"" + csName + "\":"); // Write "<name>":
        Object oMember = fld.get(oSource);
        if (oMember != null) {
          boolean bExported = exportItem(oMember);
          if (!bExported) {
            Log.logCritical(
                "Unsupported JSon serialization format; JLib.JSon.exportItem must be completed");
            return false;
          }
        } else m_sbOut.append("null");
        m_nNbItemSet++;
      } catch (IllegalArgumentException e) {
        m_sbOut.append("null");
        return false;
      } catch (IllegalAccessException e) {
        m_sbOut.append("null");
        return false;
      }
    }
    return true;
  }