Process the logging events. This is called by the batcher.

@param loggingEvents
- The logging events to be written to the underlying appender
177777
private void processLoggingEvents(List<LoggingEvent> loggingEvents) {
        // Lazy initialization of the appender. This is needed because the
        // original appenders configuration may be available only after the
        // complete
        // log4j initialization.
        while (appenders.getAllAppenders() == null) {
            if ((batcher == null) || (batcher.isPaused())) {
                try {
                    Thread.sleep(SLEEP_TIME_MS);
                } catch (InterruptedException ignore) {

                }
                continue;
            }

            org.apache.log4j.Logger asyncLogger = LoggerCache.getInstance()
                    .getOrCreateLogger(LOGGER_ASYNC_APPENDER);
            Appender originalAppender = asyncLogger
                    .getAppender(originalAppenderName);
            if (originalAppender == null) {
                try {
                    Thread.sleep(SLEEP_TIME_MS);
                } catch (InterruptedException ignore) {

                }
                continue;
            }
            appenders.addAppender(originalAppender);
        }
        // First take the overflown summary events and put it back in the queue
        for (Iterator<Entry<String, LogSummary>> iter = logSummaryMap
                .entrySet().iterator(); iter.hasNext();) {
            Entry<String, LogSummary> mapEntry = (Entry<String, LogSummary>) iter
                    .next();
            // If the space is not available, then exit immediately
            if (batcher.isSpaceAvailable()) {
                LogSummary logSummary = mapEntry.getValue();
                LoggingEvent event = logSummary.createEvent();
                // Put the event in the queue and remove the event from the summary
                if (batcher.process(event)) {
                    iter.remove();
                } else {
                    break;
                }
            } else {
                break;
            }

        }
        // Process the events from the queue and call the underlying
        // appender
        for (LoggingEvent event : loggingEvents) {
            appenders.appendLoopOnAppenders(event);

        }

    }
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);
        }
    }
1264873
@SuppressWarnings("PMD.UseVarargs")
    /* default */ void dispatch(EventPipeline pipeline,
            EventBase<?> event, Channel[] channels) {
        HandlerList handlers = getEventHandlers(event, channels);
        handlers.process(pipeline, event);
    }
1175615
def log_events
      logger = Logging.logger[target.name]
      if (logs = value.dig('report', 'logs'))
        logs.each do |log|
          case log["level"]
          when 'err'
            logger.error(log['message'])
          when 'warn'
            logger.info(log['message'])
          when 'notice'
            logger.notice(log['message'])
          when 'info'
            logger.info(log['message'])
          else
            logger.debug(log["message"])
          end
        end
      end
    end
914145
private LoggingEvent convertToEvent(Map fieldMap, String[] exception) {
    if (fieldMap == null) {
      return null;
    }

    //a logger must exist at a minimum for the event to be processed
    if (!fieldMap.containsKey(LOGGER)) {
      fieldMap.put(LOGGER, "Unknown");
    }
    if (exception == null) {
      exception = emptyException;
    }

    Logger logger = null;
    long timeStamp = 0L;
    String level = null;
    String threadName = null;
    Object message = null;
    String ndc = null;
    String className = null;
    String methodName = null;
    String eventFileName = null;
    String lineNumber = null;
    Hashtable properties = new Hashtable();

    logger = Logger.getLogger((String) fieldMap.remove(LOGGER));

    if ((dateFormat != null) && fieldMap.containsKey(TIMESTAMP)) {
      try {
        timeStamp = dateFormat.parse((String) fieldMap.remove(TIMESTAMP))
            .getTime();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    //use current time if timestamp not parseable
    if (timeStamp == 0L) {
      timeStamp = System.currentTimeMillis();
    }

    message = fieldMap.remove(MESSAGE);
    if (message == null) {
      message = "";
    }

    level = (String) fieldMap.remove(LEVEL);
    Level levelImpl;
    if (level == null) {
        levelImpl = Level.DEBUG;
    } else {
        //first try to resolve against custom level definition map, then fall back to regular levels
        levelImpl = (Level) customLevelDefinitionMap.get(level);
        if (levelImpl == null) {
            levelImpl = Level.toLevel(level.trim());
            if (!level.equals(levelImpl.toString())) {
                //check custom level map
                if (levelImpl == null) {
                    levelImpl = Level.DEBUG;
                    getLogger().debug("found unexpected level: " + level + ", logger: " + logger.getName() + ", msg: " + message);
                    //make sure the text that couldn't match a level is added to the message
                    message = level + " " + message;
                }
            }
        }
    }

    threadName = (String) fieldMap.remove(THREAD);

    ndc = (String) fieldMap.remove(NDC);

    className = (String) fieldMap.remove(CLASS);

    methodName = (String) fieldMap.remove(METHOD);

    eventFileName = (String) fieldMap.remove(FILE);

    lineNumber = (String) fieldMap.remove(LINE);

    properties.put(Constants.HOSTNAME_KEY, host);
    properties.put(Constants.APPLICATION_KEY, path);
    properties.put(Constants.RECEIVER_NAME_KEY, getName());

    //all remaining entries in fieldmap are properties
    properties.putAll(fieldMap);

    LocationInfo info = null;

    if ((eventFileName != null) || (className != null) || (methodName != null)
        || (lineNumber != null)) {
      info = new LocationInfo(eventFileName, className, methodName, lineNumber);
    } else {
      info = LocationInfo.NA_LOCATION_INFO;
    }

    LoggingEvent event = new LoggingEvent(null,
            logger, timeStamp, levelImpl, message,
            threadName,
            new ThrowableInformation(exception),
            ndc,
            info,
            properties);

    return event;
  }
954022
private void initBatcher(String appenderName) {
        MessageProcessor<LoggingEvent> messageProcessor = new MessageProcessor<LoggingEvent>() {
            @Override
            public void process(List<LoggingEvent> objects) {
                processLoggingEvents(objects);
            }
        };
        String batcherName = this.getClass().getName() + BATCHER_NAME_LIMITER
                + appenderName;
        batcher = BatcherFactory.createBatcher(batcherName, messageProcessor);
        batcher.setTarget(messageProcessor);

    }
750127
public void addEvent(LogEvent event) {
        try {
            write(getString(event));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
521081
public void removeLoggerEventListener(final LoggerEventListener listener) {
    synchronized (loggerEventListeners) {
      HierarchyEventListenerProxy proxy =
              (HierarchyEventListenerProxy) loggerEventListeners.get(listener);
      if (proxy == null) {
        LogLog.warn(
          "Ignoring attempt to remove a non-registered LoggerEventListener.");
      } else {
        loggerEventListeners.remove(listener);
        proxy.disable();
      }
    }
  }
540802
public LoggingFraction rootLogger(Level level, String... handlers) {
        rootLogger(new RootLogger().level(level)
                .handlers(handlers));
        return this;
    }
143744
@Override
    protected void append(LoggingEvent loggingEvent)
    {
        java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggingEvent.getLoggerName());
        if (logger == null) {
            LogLog.warn(format("Cannot obtain JUL %s. Verify that this appender is used while an appropriate LogManager is active.", loggingEvent.getLoggerName()));
            return;
        }

        Level level = loggingEvent.getLevel();
        java.util.logging.Level julLevel = convertLog4jLevel(level);

        LogRecord record = new LogRecord(julLevel, loggingEvent.getRenderedMessage());
        record.setMillis(loggingEvent.getTimeStamp());
        LocationInfo location = loggingEvent.getLocationInformation();
        if (location != null) {
            record.setSourceClassName(location.getClassName());
            record.setSourceMethodName(location.getMethodName());
        }

        logger.log(record);
    }
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);
  }
299110
protected void setupLogging() {
		super.setupLogging();

		final Logger rootLogger = LogManager.getRootLogger();
		rootLogger.addAppender(new NullAppender());
		final Logger logger = LogManager.getLogger("org.jvnet.hyperjaxb3");

		final Log log = getLog();
		logger.addAppender(new Appender(getLog(), new PatternLayout(
				"%m%n        %c%n")));

		if (this.getDebug()) {
			log.debug("Logger level set to [debug].");
			logger.setLevel(Level.DEBUG);
		} else if (this.getVerbose())
			logger.setLevel(Level.INFO);
		else if (log.isWarnEnabled())
			logger.setLevel(Level.WARN);
		else
			logger.setLevel(Level.ERROR);
	}
316948
public void setBackupVaultEvents(java.util.Collection<String> backupVaultEvents) {
        if (backupVaultEvents == null) {
            this.backupVaultEvents = null;
            return;
        }

        this.backupVaultEvents = new java.util.ArrayList<String>(backupVaultEvents);
    }
941902
public synchronized void dispatchEvent(LogRecord event) {
        if (binaryHandler == null || 
        	((textHandler == null && logRepositoryConfiguration.isTextEnabled()) || 
        	(textHandler != null && !logRepositoryConfiguration.isTextEnabled()))) {
            determineHandlers();
        }
        if (binaryHandler == null)	{ 	// Either doing LogManager Reset, or major issue occurring 666241.1
        	return ;
        } else {
            binaryHandler.publish(event);
        }
        if (textHandler != null) {
            textHandler.publish(event);
        }
    }
1320943
private void configureDirectToConsoleLoggers(LoggerContext context, String... loggerNames) {
    RootLoggerConfig config = newRootLoggerConfigBuilder()
      .setProcessId(ProcessId.APP)
      .setThreadIdFieldPattern("")
      .build();
    String logPattern = helper.buildLogPattern(config);
    ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(context, "CONSOLE", logPattern);

    for (String loggerName : loggerNames) {
      Logger consoleLogger = context.getLogger(loggerName);
      consoleLogger.setAdditive(false);
      consoleLogger.addAppender(consoleAppender);
    }
  }
82876
public static void logMethodCalls() {
    Logger logger = Logger.getLogger(Datastore.class.getName());
    logger.setLevel(Level.FINE);
    if (!Arrays.asList(logger.getHandlers()).contains(getStreamHandler())) {
      logger.addHandler(getStreamHandler());
    }
  }
574113
protected void logEvent(FaxClientSpiProxyEventType eventType,Method method,Object[] arguments,Object output,Throwable throwable)
    {
        //init log data
        int amount=3;
        int argumentsAmount=0;
        if(arguments!=null)
        {
            argumentsAmount=arguments.length;
        }
        if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE)
        {
            amount=amount+2;
        }
        Object[] logData=new Object[amount+argumentsAmount];
        
        //set log data values
        switch(eventType)
        {
            case PRE_EVENT_TYPE:
                logData[0]="Invoking ";
                break;
            case POST_EVENT_TYPE:
                logData[0]="Invoked ";
                break;
            case ERROR_EVENT_TYPE:
                logData[0]="Error while invoking ";
                break;
        }
        logData[1]=method.getName();
        if(argumentsAmount>0)
        {
            logData[2]=" with data: ";
            System.arraycopy(arguments,0,logData,3,argumentsAmount);
        }
        else
        {
            logData[2]="";
        }
        if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE)
        {
            logData[3+argumentsAmount]="\nOutput: ";
            logData[4+argumentsAmount]=output;
        }

        //get logger
        Logger logger=this.getLogger();
        
        //log event
        switch(eventType)
        {
            case PRE_EVENT_TYPE:
            case POST_EVENT_TYPE:
                logger.logDebug(logData,throwable);
                break;
            case ERROR_EVENT_TYPE:
                logger.logError(logData,throwable);
                break;
        }
    }