Used directly by {@link FragmentTaskLogMessage} to embed FTMs
488316
void flattenToSubMessageBuffer(ByteBuffer buf) throws IOException
    {
        // See Serialization Format comment above getSerializedSize().

        assert(m_items != null);
        assert(!m_items.isEmpty());

        buf.put(VoltDbMessageFactory.FRAGMENT_TASK_ID);
        super.flattenToBuffer(buf);

        // Get useful statistics for the header and optional blocks.
        short nInputDepIds = 0;
        short nOutputDepIds = 0;
        short nUnplanned = 0;
        for (FragmentData item : m_items) {
            if (item.m_inputDepId != -1) {
                // Supporting only one input dep id for now.
                nInputDepIds++;
            }
            if (item.m_outputDepId != null) {
                nOutputDepIds++;
            }
            if (item.m_fragmentPlan != null) {
                nUnplanned++;
            }
        }

        // Header block
        buf.putShort((short) m_items.size());
        buf.putShort(nUnplanned);
        buf.put(m_isFinal ? (byte) 1 : (byte) 0);
        buf.put(m_taskType);
        buf.put(m_emptyForRestart ? (byte) 1 : (byte) 0);
        buf.put(m_executedOnPreviousLeader ? (byte) 1 : (byte) 0);
        buf.put(nOutputDepIds > 0 ? (byte) 1 : (byte) 0);
        buf.put(nInputDepIds  > 0 ? (byte) 1 : (byte) 0);
        if (m_procNameToLoad != null) {
            buf.putShort((short) m_procNameToLoad.length);
            buf.put(m_procNameToLoad);
        }
        else {
            buf.putShort((short) -1);
        }
        buf.put(m_perFragmentStatsRecording ? (byte) 1 : (byte) 0);
        buf.put(m_coordinatorTask ? (byte) 1 : (byte) 0);
        // N Partition Transaction PartitionCount
        buf.put(m_nPartTxn ? (byte) 1 : (byte) 0);
        // timestamp for restarted transaction
        buf.putLong(m_restartTimestamp);

        buf.putLong(m_lastSpUniqueId);

        // Plan Hash block
        for (FragmentData item : m_items) {
            buf.put(item.m_planHash);
        }

        for (FragmentData item : m_items) {
            // write statement name
            if (item.m_stmtName == null) {
                buf.putShort((short) -1);
            }
            else {
                assert(item.m_stmtName.length <= Short.MAX_VALUE);
                buf.putShort((short) item.m_stmtName.length);
                buf.put(item.m_stmtName);
            }
        }

        // Parameter set block
        for (FragmentData item : m_items) {
            buf.putInt(item.m_parameterSet.remaining());
            buf.put(item.m_parameterSet.asReadOnlyBuffer());
        }

        // Optional output dependency ID block
        if (nOutputDepIds > 0) {
            for (FragmentData item : m_items) {
                buf.putInt(item.m_outputDepId);
            }
        }

        // Optional input dependency ID block
        if (nInputDepIds > 0) {
            for (FragmentData item : m_items) {
                if (item.m_inputDepId == -1) {
                    buf.putShort((short) 0);
                } else {
                    buf.putShort((short) 1);
                    buf.putInt(item.m_inputDepId);
                }
            }
        }

        // write procedure name
        if (m_procedureName == null) {
            buf.putShort((short) -1);
        }
        else {
            assert(m_procedureName.length <= Short.MAX_VALUE);
            buf.putShort((short) m_procedureName.length);
            buf.put(m_procedureName);
        }

        // ints for batch context
        buf.putInt(m_currentBatchIndex);

        // put byte flag for timeout value and 4 bytes integer value if specified
        if (m_batchTimeout == BatchTimeoutOverrideType.NO_TIMEOUT) {
            buf.put(BatchTimeoutOverrideType.NO_OVERRIDE_FOR_BATCH_TIMEOUT.getValue());
        } else {
            buf.put(BatchTimeoutOverrideType.HAS_OVERRIDE_FOR_BATCH_TIMEOUT.getValue());
            buf.putInt(m_batchTimeout);
        }

        buf.putShort((short) m_involvedPartitions.size());
        for (int pid : m_involvedPartitions) {
            buf.putInt(pid);
        }

        if (m_initiateTaskBuffer != null) {
            ByteBuffer dup = m_initiateTaskBuffer.duplicate();
            buf.putInt(dup.remaining());
            buf.put(dup);
        } else {
            buf.putInt(0);
        }

        // Unplanned item block
        for (short index = 0; index < m_items.size(); index++) {
            // Each unplanned item gets:
            //  - an index (2)
            //  - a size (4)
            //  - buffer for the fragment plan string
            //  - a size(4)
            //  - buffer for the statement text
            FragmentData item = m_items.get(index);
            if (item.m_fragmentPlan != null) {
                buf.putShort(index);
                buf.putInt(item.m_fragmentPlan.length);
                buf.put(item.m_fragmentPlan);

                assert(item.m_stmtText != null);
                buf.putInt(item.m_stmtText.length);
                buf.put(item.m_stmtText);
            }
        }

    }
121223
function(targetLevelObject, message, messageArgs)
  {
    // the message should not be logged if the target
    // level is more verbose than the current level
    if (targetLevelObject.level <= currlevelObject.level)
    {
      // substitute the messageArgs into the message template
      messageArgs.unshift(message);
      message = Util.format.apply(Util, messageArgs);

      // truncate the message if it's too long
      if (message.length > messageMaxLength)
      {
        message = message.slice(0, messageMaxLength);
      }

      // if needed, add the current time to the front of the message
      if (includeTimestamp)
      {
        message = Util.format(
            '[%s]: %s', moment().format('h:mm:ss.ms A'), message);
      }

      // log the message
      logMessage(targetLevelObject.tag, message, bufferMaxLength);
    }
  }
1136971
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public static void showOnLoaderCallback(final android.app.FragmentManager manager, final android.app.DialogFragment fragment, final String tag) {
        showOnLoaderCallback(HandlerUtils.getMainHandler(), manager, fragment, tag);
    }
1310987
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            for (XmlFragment frag : fragments) {
                frag.visit(v);
            }
        }
    }
360677
private Runnable createRunnableLoggingTask(final Level level,
            final Object message, final Throwable t) {
        // While logging, the logger thread temporarily disguises itself as its caller.
        final String callerThreadName = Thread.currentThread().getName();

        final Runnable runnableLoggingTask = new Runnable() {
            @Override
            public void run() {
                Thread loggerThread = Thread.currentThread();
                loggerThread.setName(callerThreadName);
                try {
                    m_logger.log(level, message, t);
                } catch (Throwable t) {
                    System.err.println("Exception thrown in logging thread for " +
                            callerThreadName + ":" + t);
                } finally {
                    loggerThread.setName(ASYNCH_LOGGER_THREAD_NAME);
                }
            }
        };
        return runnableLoggingTask;
    }
1270261
public static ProgressDialogFragment show(FragmentManager fragmentManager,
                                              CharSequence title, CharSequence message, boolean cancelable) {
        ProgressDialogFragment dialogFragment = new ProgressDialogFragment();
        dialogFragment.mTitle = title;
        dialogFragment.mMessage = message;
        dialogFragment.setCancelable(cancelable);
        dialogFragment.show(fragmentManager, TAG);
        return dialogFragment;
    }
106831
@Override
    public void writeFragmentTo(MwsWriter w) {
        w.write("ListOrderItemsResult", listOrderItemsResult);
        w.write("ResponseMetadata", responseMetadata);
    }
197836
private void addWinsStdoutStderrLog(List<java.util.concurrent.Callable<List<FileContent>>> tasks, final Node node, final SmartLogFetcher logFetcher) {
        final FilePath rootPath = node.getRootPath();
        if (rootPath != null) {
            // rotated log files stored on the disk
            tasks.add(new java.util.concurrent.Callable<List<FileContent>>(){
                public List<FileContent> call() throws Exception {
                    List<FileContent> result = new ArrayList<FileContent>();
                    final Map<String, File> logFiles = logFetcher.forNode(node).getLogFiles(rootPath);
                    for (Map.Entry<String, File> entry : logFiles.entrySet()) {
                        result.add(new FileContent(
                                "nodes/slave/{0}/logs/winsw/{1}", new String[] {node.getNodeName(), entry.getKey()},
                                entry.getValue(), FileListCapComponent.MAX_FILE_SIZE)
                        );
                    }
                    return result;
                }
            });
        }
    }
733758
@Override
    public void writeFragmentTo(MwsWriter w) {
        w.write("GetOrderResult", getOrderResult);
        w.write("ResponseMetadata", responseMetadata);
    }
982179
public static Map<String, String> parseFragment(String fragment)
  {
    Map<String, String> result = new TreeMap<String, String>();

    fragment = StringUtils.removeStart(fragment, "!");

    String[] split = StringUtils.split(fragment, "&");
    for (String s : split)
    {
      String[] parts = s.split("=", 2);
      String name = parts[0].trim();
      String value = "";
      if (parts.length == 2)
      {
        try
        {
          // every name that starts with "_" is base64 encoded
          if (name.startsWith("_"))
          {
            value = new String(Base64.decodeBase64(parts[1]), "UTF-8");
          }
          else
          {
            value = URLDecoder.decode(parts[1], "UTF-8");
          }
        }
        catch (UnsupportedEncodingException ex)
        {
          log.error(ex.getMessage(), ex);
        }
      }
      name = StringUtils.removeStart(name, "_");

      result.put(name, value);
    }
    return result;
  }
234032
@Override
  public Set<DataSegment> perform(Task task, TaskActionToolbox toolbox)
  {
    return new SegmentTransactionalInsertAction(segments, null, null).perform(task, toolbox).getSegments();
  }
1043340
@Trivial
    public final void logToJobLoggerAndTraceLog(String logMsg) {
        Logger logger = getClassNameLogger();

        JoblogUtil.logRawMsgToJobLogAndTraceOnly(Level.FINE, logMsg, logger);
    }
972516
public static <C> SLF4JLogTemplate<C> toSLF4J(String loggerName, String levelName, String markerName) {
		if ("debug".equalsIgnoreCase(levelName)) {
			return new SLF4JLogTemplate.Debug<>(loggerName, markerName);
		} else if ("info".equalsIgnoreCase(levelName)) {
			return new SLF4JLogTemplate.Info<>(loggerName, markerName);
		} else if ("warn".equalsIgnoreCase(levelName)) {
			return new SLF4JLogTemplate.Warn<>(loggerName, markerName);
		} else {
			throw new IllegalArgumentException("Invalid level name " + levelName);
		}
	}
1133570
static void generateLogForContentProviderBeginning(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
		if (method.getParent().isLogEnabled()) {
			methodBuilder.addStatement("$T.info($S, uri.toString())", Logger.class, "Execute " + method.jql.operationType + " for URI %s");
		}

	}
1330920
@Override
    public void beforeDoTag(JspContext context, JspFragment fragment) {
        Map<String, String> customMap = ConfigReader.getConfig().getCustomMap();

        if (customMap == null) {
            throw new RuntimeException("사용가능한 custom tag 설정이 없습니다.\naxu4j.xml 설정파일에서 <customs> 내용을 확인하세요.");
        }

        tagBody = customMap.get(getCustomid());
        doBody  = TagUtils.toString(fragment);

        if (tagBody == null) {
            throw new RuntimeException(String.format("사용가능한 custom tag 설정이 없습니다.\naxu4j.xml 설정파일에서 <custom id=\"%s\"> 내용을 확인하세요.", getCustomid()));
        }

    }
747156
public static void generateLogForContentValuesContentProvider(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
		methodBuilder.addCode("\n// log for content values -- BEGIN\n");
		methodBuilder.addStatement("Object _contentValue");
		methodBuilder.beginControlFlow("for (String _contentKey:_contentValues.values().keySet())");
		methodBuilder.addStatement("_contentValue=_contentValues.values().get(_contentKey)");
		methodBuilder.beginControlFlow("if (_contentValue==null)");
		methodBuilder.addStatement("$T.info(\"==> :%s = <null>\", _contentKey)", Logger.class);
		methodBuilder.nextControlFlow("else");
		methodBuilder.addStatement("$T.info(\"==> :%s = '%s' (%s)\", _contentKey, $T.checkSize(_contentValue), _contentValue.getClass().getCanonicalName())", Logger.class, StringUtils.class);
		methodBuilder.endControlFlow();
		methodBuilder.endControlFlow();
		methodBuilder.addCode("// log for content values -- END\n");

	}
95004
private void setupTaskLogFileAccess(TaskControllerContext context) {
    TaskAttemptID taskId = context.task.getTaskID();
    File f = TaskLog.getTaskLogFile(taskId, TaskLog.LogName.SYSLOG);
    String taskAttemptLogDir = f.getParentFile().getAbsolutePath();
    changeDirectoryPermissions(taskAttemptLogDir, FILE_PERMISSIONS, false);
  }