Examples of LoggingEvent


Examples of org.apache.log4j.spi.LoggingEvent

     */
    public void run() {
        run = true;
        while (run) {
            try {
                LoggingEvent le = (LoggingEvent) ois.readObject();
                String line = (String) le.getMessage();
                if (line.contains("teardown")) {
                    list.add(line);
                } else {
                    int length = Integer.parseInt(
                            line.substring(line.lastIndexOf(',') + 1));
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

     
      if (exception == null) {
          exception = new String[]{""};
      }
     
      LoggingEvent loggingEvent = new LoggingEvent();
      loggingEvent.setLogger(logger);
      loggingEvent.setTimeStamp(timeStamp);
      loggingEvent.setLevel(levelImpl);
      loggingEvent.setThreadName(threadName);
      loggingEvent.setMessage(message);
      loggingEvent.setNDC(ndc);
      loggingEvent.setThrowableInformation(new ThrowableInformation(exception));
      loggingEvent.setProperties(properties);
     
      events.add(loggingEvent);
    
      logger = null;
      timeStamp = 0L;
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

        if (c == null) {
            return;
        }

        for (Iterator iter = c.iterator(); iter.hasNext();) {
            LoggingEvent evt = (LoggingEvent) iter.next();
            if (passesExpression(evt)) {
                if (evt.getProperty(Constants.HOSTNAME_KEY) != null) {
                    evt.setProperty(Constants.HOSTNAME_KEY, host);
                }
                if (evt.getProperty(Constants.APPLICATION_KEY) != null) {
                    evt.setProperty(Constants.APPLICATION_KEY, path);
                }
                doPost(evt);
            }
        }
    }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

                            properties.put(name, value);
                        }
                    }

                    Level levelImpl = Level.toLevel(level);
                    LoggingEvent event = new LoggingEvent(
                            eventLogger.getName(), eventLogger, levelImpl,
                            message, null);
                    event.setLocationInformation(new LocationInfo(fileName,
                            className, methodName, lineNumber));
                    properties.putAll(mdc);
                    event.setTimeStamp(timeStamp);
                    event.setThrowableInformation(new ThrowableInformation(
                            exception));

                    event.setProperties(properties);
                    event.setThreadName(threadName);
                    event.setNDC(ndc);
                    doPost(event);
                }
                //log when rows are retrieved
                if (lastID != oldLastID) {
                    getLogger().debug("lastID: " + lastID);
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

      Statement statement = connection.createStatement();
      ResultSet rs = statement.executeQuery(sql.toString());
      //rs.beforeFirst();

      while (rs.next()) {
        LoggingEvent event = new LoggingEvent();

        event.setSequenceNumber(rs.getLong(1));
        event.setTimeStamp(rs.getLong(2));
        event.setRenderedMessage(rs.getString(3));
        event.setLoggerName(rs.getString(4));
        String levelStr = rs.getString(5);

        // TODO CG The conversion of levelStr should be more general
        Level level = Level.toLevel(levelStr);
        event.setLevel(level);
        event.setNDC(rs.getString(6));
        event.setThreadName(rs.getString(7));

        short mask = rs.getShort(8);

        String fileName = rs.getString(9);
        String className = rs.getString(10);
        String methodName = rs.getString(11);
        String lineNumber = rs.getString(12).trim();

        if (fileName.equals(LocationInfo.NA)) {
          event.setLocationInformation(LocationInfo.NA_LOCATION_INFO);
        } else {
          event.setLocationInformation(new LocationInfo(fileName, className,
              methodName, lineNumber));
        }

        long id = rs.getLong(13);
        //LogLog.info("Received event with id=" + id);
        lastId = id;

        // Scott asked for this info to be
        event.setProperty(Constants.LOG4J_ID_KEY, Long.toString(id));

        if ((mask & DBHelper.PROPERTIES_EXIST) != 0) {
          getProperties(connection, id, event);
        }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

    //messages are listed before exceptions in additionallines
    if (additionalLines.size() > 0 && exceptionLine != 0) {
      currentMap.put(MESSAGE, buildMessage((String) currentMap.get(MESSAGE),
          exceptionLine));
    }
    LoggingEvent event = convertToEvent(currentMap, exception);
    currentMap.clear();
    additionalLines.clear();
    return event;
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

    getLogger().debug("tailing file: " + tailing);
    do {
      while ((line = bufferedReader.readLine()) != null) {
        if (eventMatcher.matches(line, regexpPattern)) {
          //build an event from the previous match (held in current map)
          LoggingEvent event = buildEvent();
          if (event != null) {
            if (passesExpression(event)) {
              doPost(event);
            }
          }
          currentMap.putAll(processEvent(eventMatcher.getMatch()));
        } else {
          //getLogger().debug("line doesn't match pattern - must be ")
          //may be an exception or additional message lines
          additionalLines.add(line);
        }
      }

      //process last event if one exists
      LoggingEvent event = buildEvent();
      if (event != null) {
        if (passesExpression(event)) {
          doPost(event);
        }
        getLogger().debug("no further lines to process in " + fileURL);
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

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

    LoggingEvent event = new LoggingEvent();
    event.setLogger(logger);
    event.setTimeStamp(timeStamp);
    event.setLevel(levelImpl);
    event.setThreadName(threadName);
    event.setMessage(message);
    event.setThrowableInformation(new ThrowableInformation(exception));
    event.setLocationInformation(info);
    event.setNDC(ndc);
    event.setProperties(properties);
    return event;
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

   * Other approaches might yield better results.
   * </p>
   */
  public void run() {
    //Category cat = Category.getInstance(Dispatcher.class.getName());
    LoggingEvent event;

    while (true) {
      synchronized (bf) {
        if (bf.length() == 0) {
          // Exit loop if interrupted but only if the the buffer is empty.
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

    }
   
    List eventList = listAppender.getList();
    int size = eventList.size();
    for(int i = 0; i < size; i++) {
      LoggingEvent event = (LoggingEvent) eventList.get(i);
      Logger xLogger = event.getLogger();
      if (event.getLevel().isGreaterOrEqual(xLogger.getEffectiveLevel())) {
        xLogger.callAppenders(event);
      }
    }
    listAppender.clearList();
    listAppender.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.