Construct a logging event from currentMap and additionalLines
(additionalLines contains multiple message lines and any exception lines)
<p>
CurrentMap and additionalLines are cleared in the process

@return event
482510
private LoggingEvent buildEvent() {
    if (currentMap.size() == 0) {
      if (additionalLines.size() > 0) {
        for (Iterator iter = additionalLines.iterator();iter.hasNext();) {
          getLogger().info("found non-matching line: " + iter.next());
        }
      }
      additionalLines.clear();
      return null;
    }
    //the current map contains fields - build an event
    int exceptionLine = getExceptionLine();
    String[] exception = buildException(exceptionLine);

    //messages are listed before exceptions in additionallines
    if (additionalLines.size() > 0 && exception.length > 0) {
      currentMap.put(MESSAGE, buildMessage((String) currentMap.get(MESSAGE),
          exceptionLine));
    }
    LoggingEvent event = convertToEvent(currentMap, exception);
    currentMap.clear();
    additionalLines.clear();
    return event;
  }
1026792
private Event newEvent(final String id, final Exception error) {
        return new EventFactorySupport().event(this, id, new LocalAttributeMap<>("error", error));
    }
605480
public void messageLogged(final BuildEvent event) {
        int priority = event.getPriority();
        // Filter out messages based on priority
        if (priority <= msgOutputLevel) {

            final String msg = expandMessage(event, event.getMessage());

            if (priority != Project.MSG_ERR) {
                printMessage(msg, out, priority);
            } else {
                printMessage(msg, err, priority);
            }
            log(msg);
        }
    }
1271518
protected EventBuilder createEventBuilder(LogRecord record) {
        EventBuilder eventBuilder = new EventBuilder()
            .withSdkIntegration("java.util.logging")
            .withLevel(getLevel(record.getLevel()))
            .withTimestamp(new Date(record.getMillis()))
            .withLogger(record.getLoggerName());

        String message = record.getMessage();
        if (record.getResourceBundle() != null && record.getResourceBundle().containsKey(record.getMessage())) {
            message = record.getResourceBundle().getString(record.getMessage());
        }

        String topLevelMessage = message;
        if (record.getParameters() == null) {
            eventBuilder.withSentryInterface(new MessageInterface(message));
        } else {
            String formatted;
            List<String> parameters = formatMessageParameters(record.getParameters());
            try {
                formatted = formatMessage(message, record.getParameters());
                topLevelMessage = formatted; // write out formatted as Event's message key
            } catch (Exception e) {
                // local formatting failed, send message and parameters without formatted string
                formatted = null;
            }
            eventBuilder.withSentryInterface(new MessageInterface(message, parameters, formatted));
        }
        eventBuilder.withMessage(topLevelMessage);

        Throwable throwable = record.getThrown();
        if (throwable != null) {
            eventBuilder.withSentryInterface(new ExceptionInterface(throwable));
        }

        Map<String, String> mdc = MDC.getMDCAdapter().getCopyOfContextMap();
        if (mdc != null) {
            for (Map.Entry<String, String> mdcEntry : mdc.entrySet()) {
                if (Sentry.getStoredClient().getMdcTags().contains(mdcEntry.getKey())) {
                    eventBuilder.withTag(mdcEntry.getKey(), mdcEntry.getValue());
                } else {
                    eventBuilder.withExtra(mdcEntry.getKey(), mdcEntry.getValue());
                }
            }
        }

        eventBuilder.withExtra(THREAD_ID, record.getThreadID());

        return eventBuilder;
    }
887533
function() {
		/** All events from last tick */
		var pendingEvents = this._annotationChangedContext.events;
		var pendingLocations = this._annotationChangedContext.locations;
		var pendingModels = this._annotationChangedContext.textModels;
		/** All unique events from last tick */
		var handlingEvents = [];
		var handlingLocations = [];
		var handlingModels = [];
		// Cleanup
		this._annotationChangedContext.timeout = undefined;
		this._annotationChangedContext.events = [];
		this._annotationChangedContext.locations = [];
		// Remove duplicate events
		for (var i = 0; i < pendingEvents.length; i++) {
			var duplicate = false;
			for (var j = 0; j < i; j++) {
				if (pendingEvents[i].textModelChangedEvent === pendingEvents[j].textModelChangedEvent) {
					duplicate = true;
				}
				break;
			}
			if (!duplicate) {
				handlingEvents.push(pendingEvents[i]);
				handlingLocations.push(pendingLocations[i]);
				handlingModels.push(pendingModels[i]);
			}
		}

		// Handle
		for (i = 0; i < handlingEvents.length; i++) {
			var e = handlingEvents[i];
			for (j = 0; j < e.changed.length; j++) {
				var annotation = e.changed[j];
				var location = handlingLocations[i];
				var oldLine;
				var newLine = handlingModels[i].getLineAtOffset(annotation.start);
				if (annotation._oldStart > e.textModelChangedEvent.start) {
					oldLine = newLine - e.textModelChangedEvent.addedLineCount + e.textModelChangedEvent.removedLineCount;
				} else {
					oldLine = handlingModels[i].getLineAtOffset(annotation._oldStart);
				}
				var before = null;
				var after = null;
				if (annotation.type === AT.ANNOTATION_BOOKMARK) {
					before = new mBreakpoint.LineBookmark(location, oldLine, annotation.title);
					after = new mBreakpoint.LineBookmark(location, newLine, annotation.title);
				} else if (annotation.type === AT.ANNOTATION_BREAKPOINT) {
					before = new mBreakpoint.LineBreakpoint(location, oldLine, annotation.title, true);
					after = new mBreakpoint.LineBreakpoint(location, newLine, annotation.title, true);
				} else if (annotation.type === AT.ANNOTATION_CONDITIONAL_BREAKPOINT) {
					before = new mBreakpoint.LineConditionalBreakpoint(location, oldLine, annotation.title, annotation.title, true);
					after = new mBreakpoint.LineConditionalBreakpoint(location, newLine, annotation.title, annotation.title, true);
				}
				if (before && after) {
					this.debugService.updateBreakpoint(before, after, true);
				}
			}
		}
	}
762356
public static LogEvent prepareLogEvent(final LogEvent logEvent) {
        val messageModified = TicketIdSanitizationUtils.sanitize(logEvent.getMessage().getFormattedMessage());
        val message = new SimpleMessage(messageModified);
        val newLogEventBuilder = Log4jLogEvent.newBuilder()
            .setLevel(logEvent.getLevel())
            .setLoggerName(logEvent.getLoggerName())
            .setLoggerFqcn(logEvent.getLoggerFqcn())
            .setContextData(new SortedArrayStringMap(logEvent.getContextData()))
            .setContextStack(logEvent.getContextStack())
            .setEndOfBatch(logEvent.isEndOfBatch())
            .setIncludeLocation(logEvent.isIncludeLocation())
            .setMarker(logEvent.getMarker())
            .setMessage(message)
            .setNanoTime(logEvent.getNanoTime())
            .setThreadName(logEvent.getThreadName())
            .setThrownProxy(logEvent.getThrownProxy())
            .setThrown(logEvent.getThrown())
            .setTimeMillis(logEvent.getTimeMillis());

        try {
            newLogEventBuilder.setSource(logEvent.getSource());
        } catch (final Exception e) {
            newLogEventBuilder.setSource(null);
        }
        return newLogEventBuilder.build();
    }
218673
protected EventBuilder createEventBuilder(ILoggingEvent iLoggingEvent) {
        EventBuilder eventBuilder = new EventBuilder()
            .withSdkIntegration("logback")
            .withTimestamp(new Date(iLoggingEvent.getTimeStamp()))
            .withMessage(iLoggingEvent.getFormattedMessage())
            .withLogger(iLoggingEvent.getLoggerName())
            .withLevel(formatLevel(iLoggingEvent.getLevel()))
            .withExtra(THREAD_NAME, iLoggingEvent.getThreadName());

        if (iLoggingEvent.getArgumentArray() != null) {
            eventBuilder.withSentryInterface(new MessageInterface(
                iLoggingEvent.getMessage(),
                formatMessageParameters(iLoggingEvent.getArgumentArray()),
                iLoggingEvent.getFormattedMessage()));
        }

        if (iLoggingEvent.getThrowableProxy() != null) {
            eventBuilder.withSentryInterface(new ExceptionInterface(extractExceptionQueue(iLoggingEvent)));
        } else if (iLoggingEvent.getCallerData().length > 0) {
            eventBuilder.withSentryInterface(new StackTraceInterface(iLoggingEvent.getCallerData()));
        }

        for (Map.Entry<String, String> contextEntry : iLoggingEvent.getLoggerContextVO().getPropertyMap().entrySet()) {
            eventBuilder.withExtra(contextEntry.getKey(), contextEntry.getValue());
        }

        for (Map.Entry<String, String> mdcEntry : iLoggingEvent.getMDCPropertyMap().entrySet()) {
            if (Sentry.getStoredClient().getMdcTags().contains(mdcEntry.getKey())) {
                eventBuilder.withTag(mdcEntry.getKey(), mdcEntry.getValue());
            } else {
                eventBuilder.withExtra(mdcEntry.getKey(), mdcEntry.getValue());
            }
        }

        if (iLoggingEvent.getMarker() != null) {
            eventBuilder.withTag(LOGBACK_MARKER, iLoggingEvent.getMarker().getName());
        }

        return eventBuilder;
    }
72166
public Event[] getEvents() {
    ArrayList elist = new ArrayList();

    try {
      String s = br.readLine();
      while (s != null) {
        String[] spaceToks = s.split(" ");
        for (int tok = 0; tok < spaceToks.length; tok++) {
          StringBuffer sb = new StringBuffer(spaceToks[tok]);
          if (TokenizerME.alphaNumeric.matcher(spaceToks[tok]).matches()) {
            int lastIndex = sb.length() - 1;
            for (int id = 0; id < sb.length(); id++) {
              String[] context = cg.getContext(new ObjectIntPair(sb, id));
              if (id == lastIndex) {
                elist.add(new Event("T", context));
              }
              else {
                elist.add(new Event("F", context));
              }
            }
          }
        }
        s = br.readLine();
      }
    }
    catch (Exception e) {
      e.printStackTrace();
    }

	Event[] events = new Event[elist.size()];
	elist.toArray(events);
        return events;

    }
104280
@Override
    public MessageEvent parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
                    throws XmlPullParserException, IOException {
        MessageEvent messageEvent = new MessageEvent();
        boolean done = false;
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG) {
                if (parser.getName().equals("id"))
                    messageEvent.setStanzaId(parser.nextText());
                if (parser.getName().equals(MessageEvent.COMPOSING))
                    messageEvent.setComposing(true);
                if (parser.getName().equals(MessageEvent.DELIVERED))
                    messageEvent.setDelivered(true);
                if (parser.getName().equals(MessageEvent.DISPLAYED))
                    messageEvent.setDisplayed(true);
                if (parser.getName().equals(MessageEvent.OFFLINE))
                    messageEvent.setOffline(true);
            } else if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals("x")) {
                    done = true;
                }
            }
        }

        return messageEvent;
    }
339786
protected EventBuilder createEventBuilder(LoggingEvent loggingEvent) {
        EventBuilder eventBuilder = new EventBuilder()
            .withSdkIntegration("log4j")
            .withTimestamp(new Date(loggingEvent.getTimeStamp()))
            .withMessage(loggingEvent.getRenderedMessage())
            .withLogger(loggingEvent.getLoggerName())
            .withLevel(formatLevel(loggingEvent.getLevel()))
            .withExtra(THREAD_NAME, loggingEvent.getThreadName());

        ThrowableInformation throwableInformation = null;
        try {
            throwableInformation = loggingEvent.getThrowableInformation();
        } catch (NullPointerException expected) {
            // `throwableInformation` is already set.
        }

        if (throwableInformation != null) {
            Throwable throwable = throwableInformation.getThrowable();
            eventBuilder.withSentryInterface(new ExceptionInterface(throwable));
        } else if (loggingEvent.getLocationInformation().fullInfo != null) {
            LocationInfo location = loggingEvent.getLocationInformation();
            if (!LocationInfo.NA.equals(location.getFileName()) && !LocationInfo.NA.equals(location.getLineNumber())) {
                StackTraceElement[] stackTrace = {asStackTraceElement(location)};
                eventBuilder.withSentryInterface(new StackTraceInterface(stackTrace));
            }
        }

        if (loggingEvent.getNDC() != null) {
            eventBuilder.withExtra(LOG4J_NDC, loggingEvent.getNDC());
        }

        Set<String> extraTags = Sentry.getStoredClient().getMdcTags();
        @SuppressWarnings("unchecked")
        Map<String, Object> properties = (Map<String, Object>) loggingEvent.getProperties();
        for (Map.Entry<String, Object> mdcEntry : properties.entrySet()) {
            if (extraTags.contains(mdcEntry.getKey())) {
                eventBuilder.withTag(mdcEntry.getKey(), mdcEntry.getValue().toString());
            } else {
                eventBuilder.withExtra(mdcEntry.getKey(), mdcEntry.getValue());
            }
        }

        return eventBuilder;
    }
206305
public CloudTrailEvent getNextEvent() throws IOException {
        CloudTrailEventData eventData = new CloudTrailEventData();
        String key;

         /* Get next CloudTrailEvent event from log file. When failed to parse a event,
         * IOException will be thrown. In this case, the charEnd index the place we
         * encountered parsing error. */

        // return the starting location of the current token; that is, position of the first character
        // from input that starts the current token
        int charStart = (int) jsonParser.getTokenLocation().getCharOffset();

        while(jsonParser.nextToken() != JsonToken.END_OBJECT) {
            key = jsonParser.getCurrentName();

            switch (key) {
            case "eventVersion":
                String eventVersion = jsonParser.nextTextValue();
                if (Double.parseDouble(eventVersion) > SUPPORTED_EVENT_VERSION) {
                    logger.debug(String.format("EventVersion %s is not supported by CloudTrail.", eventVersion));
                }
                eventData.add(key, eventVersion);
                break;
            case "userIdentity":
                this.parseUserIdentity(eventData);
                break;
            case "eventTime":
                eventData.add(CloudTrailEventField.eventTime.name(), convertToDate(jsonParser.nextTextValue()));
                break;
            case "eventID":
                eventData.add(key, convertToUUID(jsonParser.nextTextValue()));
                break;
            case "readOnly":
                this.parseReadOnly(eventData);
                break;
            case "resources":
                this.parseResources(eventData);
                break;
            case "managementEvent":
                this.parseManagementEvent(eventData);
                break;
            default:
                eventData.add(key, parseDefaultValue(key));
                break;
            }
        }
        this.setAccountId(eventData);

        // event's last character position in the log file.
        int charEnd = (int) jsonParser.getTokenLocation().getCharOffset();

        CloudTrailEventMetadata metaData = getMetadata(charStart, charEnd);

        return new CloudTrailEvent(eventData, metaData);
    }
195380
public static function log()
    {
        if (!isset(self::core()->log)) {
            //====================================================================//
            // Initialize Log & Debug
            self::core()->log = new Logger();

            //====================================================================//
            //  Define Standard Messages Prefix if Not Overiden
            if (isset(self::configuration()->localname)) {
                self::core()->log->setPrefix(self::configuration()->localname);
            }
        }

        return self::core()->log;
    }
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();
        }

    }
523364
@Override
    protected XMLEvent internalNextEvent() throws XMLStreamException {
        // If there is an iterator to read from reset was called, use the iterator
        // until it runs out of events.
        if (this.bufferReader != null) {
            final XMLEvent event = this.bufferReader.next();

            // If nothing left in the iterator, remove the reference and fall through to direct
            // reading
            if (!this.bufferReader.hasNext()) {
                this.bufferReader = null;
            }

            return event;
        }

        // Get the next event from the underlying reader
        final XMLEvent event = this.getParent().nextEvent();

        // if buffering add the event
        if (this.eventLimit != 0) {
            this.eventBuffer.offer(event);

            // If limited buffer size and buffer is too big trim the buffer.
            if (this.eventLimit > 0 && this.eventBuffer.size() > this.eventLimit) {
                this.eventBuffer.poll();
            }
        }

        return event;
    }
254554
private static function event()
    {
        $files = ['Event', 'EventListener'];
        $folder = static::$root.'Event'.'/';

        self::call($files, $folder);

        $files = ['ManyListenersArgumentsException'];
        $folder = static::$root.'Event/Exceptions'.'/';

        self::call($files, $folder);
    }
1340481
@Override
    public int appendLoopOnAppenders(LoggingEvent event) {
        int size = 0;
        Appender appender;
        if (appenderList != null) {
            size = appenderList.size();
            Iterator<Appender> it = appenderList.iterator();
            while (it.hasNext()) {
                appender = (Appender) it.next();
                appender.doAppend(event);
            }
        }
        return size;
    }
1161952
function(logLevel, message, exception) {
		var loggingEvent = new Log4js.LoggingEvent(this.category, logLevel, 
			message, exception, this);
		this.loggingEvents.push(loggingEvent);
		this.onlog.dispatch(loggingEvent);
	}