Appends initial entries to the log to take leadership.
192636
private CompletableFuture<Void> appendInitialEntries() {
    final long term = raft.getTerm();

    return appendAndCompact(new InitializeEntry(term, appender.getTime())).thenApply(index -> null);
  }
785406
public void append(final LoggingEvent event) {
        boolean isBufferSpaceAvailable = (batcher.isSpaceAvailable() && (logSummaryMap
                .size() == 0));
        boolean isBufferPutSuccessful = false;
        LocationInfo locationInfo = null;
        // Reject it when we have a fast property as these can be expensive
        Stopwatch s = locationInfoTimer.start();
        if (CONFIGURATION.shouldSummarizeOverflow(this.originalAppenderName)) {
            if (CONFIGURATION.shouldGenerateBlitz4jLocationInfo()) {
                locationInfo = LoggingContext.getInstance()
                        .generateLocationInfo(event);
            } else if (CONFIGURATION.shouldGenerateLog4jLocationInfo()) {
                locationInfo = event.getLocationInformation();
            }
        }
        s.stop();

        if (isBufferSpaceAvailable) {
            // Save the thread local info in the event so that the
            // processing threads can have access to the thread local of the arriving event
            Stopwatch sThreadLocal = saveThreadLocalTimer.start();
            saveThreadLocalInfo(event);
            sThreadLocal.stop();
            isBufferPutSuccessful = putInBuffer(event);
        }
        // If the buffer is full, then summarize the information
        if (CONFIGURATION.shouldSummarizeOverflow(this.originalAppenderName) && (!isBufferPutSuccessful)) {
            summarizeEventCounter.increment();
            Stopwatch t = putDiscardMapTimeTracer.start();
            String loggerKey = event.getLoggerName();
            if (locationInfo != null) {
                loggerKey = locationInfo.getClassName() + "_"
                        + locationInfo.getLineNumber();
            }

            LogSummary summary = (LogSummary) logSummaryMap.get(loggerKey);
            if (summary == null) {
                // Saving the thread local info is needed only for the first
                // time
                // creation of the summary
                saveThreadLocalInfo(event);
                summary = new LogSummary(event);
                logSummaryMap.put(loggerKey, summary);
            } else {
                // The event summary is already there, just increment the
                // count
                summary.add(event);
            }
            t.stop();
        } else if (!CONFIGURATION.shouldSummarizeOverflow(this.originalAppenderName) && (!isBufferPutSuccessful)) {
            // Record the event that are not summarized and which are just
            // discarded
            discardEventCounter.increment();
        }

    }
896356
private function initializeLogFile()
    {
        $this->log = $this->dir.'/builds.log';

        if (!file_exists($this->log)) {
            $data = array(
                'last_update' => null,
                'projects'    => array(),
            );

            file_put_contents($this->log, serialize($data));
        }
    }
482877
@SuppressWarnings("unchecked")
  protected AppendRequest buildAppendEntriesRequest(RaftMemberContext member, long lastIndex) {
    final RaftLogReader reader = member.getLogReader();

    final Indexed<RaftLogEntry> prevEntry = reader.getCurrentEntry();

    final DefaultRaftMember leader = raft.getLeader();
    AppendRequest.Builder builder = AppendRequest.builder()
        .withTerm(raft.getTerm())
        .withLeader(leader != null ? leader.memberId() : null)
        .withPrevLogIndex(prevEntry != null ? prevEntry.index() : reader.getFirstIndex() - 1)
        .withPrevLogTerm(prevEntry != null ? prevEntry.entry().term() : 0)
        .withCommitIndex(raft.getCommitIndex());

    // Build a list of entries to send to the member.
    final List<RaftLogEntry> entries = new ArrayList<>();

    // Build a list of entries up to the MAX_BATCH_SIZE. Note that entries in the log may
    // be null if they've been compacted and the member to which we're sending entries is just
    // joining the cluster or is otherwise far behind. Null entries are simply skipped and not
    // counted towards the size of the batch.
    // If there exists an entry in the log with size >= MAX_BATCH_SIZE the logic ensures that
    // entry will be sent in a batch of size one
    int size = 0;

    // Iterate through the log until the last index or the end of the log is reached.
    while (reader.hasNext()) {
      // Otherwise, read the next entry and add it to the batch.
      Indexed<RaftLogEntry> entry = reader.next();
      entries.add(entry.entry());
      size += entry.size();
      if (entry.index() == lastIndex || size >= MAX_BATCH_SIZE) {
        break;
      }
    }

    // Add the entries to the request builder and build the request.
    return builder.withEntries(entries).build();
  }
1213253
private void performNextWrite() {
        Append append = getNextAppend();
        if (append == null) {
            return;
        }
        long traceId = LoggerHelpers.traceEnter(log, "storeAppend", append);
        Timer timer = new Timer();
        storeAppend(append)
                .whenComplete((v, e) -> {
                    handleAppendResult(append, e, timer);
                    LoggerHelpers.traceLeave(log, "storeAppend", traceId, v, e);
                })
                .whenComplete((v, e) -> append.getData().release());
    }
904036
def setLogEntries(self, entries, save=True, update_policies=True):
        """"""
        prev = None;  # "previous" valid entry for "Prev" link
        uplink = os.path.join("..", Purr.RenderIndex.INDEX);  # "Up" link
        self.entries = []
        for entry in entries:
            if not entry.ignore:
                entry.setPrevUpNextLinks(prev=prev, up=uplink)
                prev = entry
                self.entries.append(entry)
        if save:
            self.save()
        if update_policies:
            # populate default policies and renames based on entry list
            self._default_dp_props = {}
            for entry in entries:
                self.updatePoliciesFromEntry(entry)
            dprint(4, "default policies:", self._default_dp_props)
898156
private void takeLeadership() {
    raft.setLeader(raft.getCluster().getMember().memberId());
    raft.getCluster().getRemoteMemberStates().forEach(m -> m.resetState(raft.getLog()));
  }
726540
private void appendEntry(Map.Entry<String, EDBObjectEntry> entry, StringBuilder builder) {
        if (builder.length() > 2) {
            builder.append(",");
        }
        builder.append(" \"").append(entry.getKey()).append("\"");
        builder.append(" : ").append(entry.getValue());
    }
433528
def createSummary(self, log):
        
        warnings = self.obs.warnings
        errors = []
        if warnings:
            self.addCompleteLog('%d Warnings' % len(warnings), "\n".join(warnings))
        if errors:
            self.addCompleteLog('%d Errors' % len(errors), "\n".join(errors))
1225254
def _init_append(self):
        
        # Require to load the full file content in buffer
        self._write_buffer[:] = self._readall()

        # Make initial seek position to current end of file
        self._seek = self._size
93772
protected void addPartnerEntry(PartnerLogData logData) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "addPartnerEntry", logData);

        final int result = _partnerLogTable.size();

        _partnerLogTable.add(result, logData);

        // Let the entry know where it's been put
        // Actually, fool it into thinking it's one entry higher to invalidate 0
        logData.setIndex(result + 1);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "addPartnerEntry", result + 1);
    }
528043
def add_line(self, logevent):
        """"""
        key = None
        self.empty = False
        self.groups.setdefault(key, list()).append(logevent)
1249169
def _init_append(self):
        
        if self._content_length:
            # Adjust size if content length specified
            with _handle_azure_exception():
                self._resize(
                    content_length=self._content_length, **self._client_kwargs)
                self._reset_head()

        # Make initial seek position to current end of file
        self._seek = self._size
51571
public boolean append(AuditContext context) {
    try {
      mAuditLogEntries.put(context);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      return false;
    }
    return true;
  }
1271391
def _add_entry (self, entry):
        
        if "*" in entry.useragents:
            # the default entry is considered last
            self.default_entry = entry
        else:
            self.entries.append(entry)
374815
@Override
	protected void append( LoggingEvent event) {

		// Render the event according to layout
		String formattedEvent = layout.format( event);

		// Append stack trace if present and layout does not handle it
		if (layout.ignoresThrowable()) {
			String[] stack = event.getThrowableStrRep();
			if (stack != null)
			{
				int len = stack.length;
				formattedEvent += ", ";
				for(int i = 0; i < len; i++)
				{
					formattedEvent += stack[i];
					if(i < len - 1)
						formattedEvent += "\u2028";
				}
			}
		}
				
		// Prepare to be queued
		this.le_async.addLineToQueue(formattedEvent);
	}
1061801
final void dispatchToAppender(final LoggingEvent customLoggingEvent) {
    // wrap the LoggingEvent in a FileRollEvent to prevent recursion bug
    final FoundationFileRollingAppender appender = this.getSource();
    if (appender != null) {
      appender.append(new FileRollEvent(customLoggingEvent, this));
    }
  }