Examples of LocationInfo


Examples of org.apache.log4j.spi.location.LocationInfo

      insertStatement.setString(5, event.getLevel().toString());
      insertStatement.setString(6, event.getNDC());
      insertStatement.setString(7, event.getThreadName());
      insertStatement.setShort(8, DBHelper.computeReferenceMask(event));

      LocationInfo li;

      if (event.locationInformationExists() || locationInfo) {
        li = event.getLocationInformation();
      } else {
        li = LocationInfo.NA_LOCATION_INFO;
      }

      insertStatement.setString(9, li.getFileName());
      insertStatement.setString(10, li.getClassName());
      insertStatement.setString(11, li.getMethodName());
      insertStatement.setString(12, li.getLineNumber());

      int updateCount = insertStatement.executeUpdate();
      if (updateCount != 1) {
        getLogger().warn("Failed to insert loggingEvent");
      }
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

        insertStatement.setString(5, event.getLevel().toString());
        insertStatement.setString(6, event.getNDC());
        insertStatement.setString(7, event.getThreadName());
        insertStatement.setShort(8, DBHelper.computeReferenceMask(event));

        LocationInfo li;

        if (event.locationInformationExists() || locationInfo) {
          li = event.getLocationInformation();
        } else {
          li = LocationInfo.NA_LOCATION_INFO;
        }
        insertStatement.setString(9, li.getFileName());
        insertStatement.setString(10, li.getClassName());
        insertStatement.setString(11, li.getMethodName());
        insertStatement.setString(12, li.getLineNumber());

        //LogLog.info("*** performing insertion.");
        insertStatement.addBatch();
      }

View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

   */
  public int decide(LoggingEvent event) {
    if (!event.locationInformationExists()) {
      if (expressionRule.evaluate(event)) {
        Throwable t = new Exception();
        event.setLocationInformation(new LocationInfo(t, className));
      }
    }
    return Filter.NEUTRAL;
  }
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

            }
          }
        }
      }

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

      if (exception == null) {
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

   */
  public LocationInfo getLocationInformation() {
    // we rely on the fact that fqnOfLoggerClass does not survive
    // serialization
    if (locationInfo == null && fqnOfLoggerClass != null) {
      locationInfo = new LocationInfo(new Throwable(), fqnOfLoggerClass);
    }
    return locationInfo;
  }
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

    return false;
  }

  public Object getValue(String fieldName, LoggingEvent event) {
    String upperField = fieldName.toUpperCase();
    LocationInfo info = null;
    if (event.locationInformationExists()) {
        info = event.getLocationInformation();
    }
    if (LOGGER_FIELD.equals(upperField)) {
      return event.getLoggerName();
    } else if (LEVEL_FIELD.equals(upperField)) {
      return event.getLevel();
    } else if (CLASS_FIELD.equals(upperField)) {
      return ((info == null) ? EMPTY_STRING : info.getClassName());
    } else if (FILE_FIELD.equals(upperField)) {
      return ((info == null) ? EMPTY_STRING : info.getFileName());
    } else if (LINE_FIELD.equals(upperField)) {
      return ((info == null) ? EMPTY_STRING : info.getLineNumber());
    } else if (METHOD_FIELD.equals(upperField)) {
      return ((info == null) ? EMPTY_STRING : info.getMethodName());
    } else if (MSG_FIELD.equals(upperField)) {
      return event.getMessage();
    } else if (NDC_FIELD.equals(upperField)) {
      String ndcValue = event.getNDC();
      return ((ndcValue == null) ? EMPTY_STRING : ndcValue);
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

        output.write("]]></log4j:throwable>\r\n");
      }
    }

    if (locationInfo) {
      LocationInfo locationInfo = event.getLocationInformation();
      output.write("<log4j:locationInfo class=\"");
      output.write(locationInfo.getClassName());
      output.write("\" method=\"");
      Transform.escapeTags(locationInfo.getMethodName(), output);
      output.write("\" file=\"");
      output.write(locationInfo.getFileName());
      output.write("\" line=\"");
      output.write(locationInfo.getLineNumber());
      output.write("\"/>\r\n");
    }

    Set propertySet = event.getPropertyKeySet();
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

    eventContainer.addThread(event.getThreadName());
    eventContainer.addNDC(event.getNDC());
    eventContainer.addProperties(event.getProperties());

    if (event.locationInformationExists()) {
      LocationInfo info = event.getLocationInformation();
      eventContainer.addClass(info.getClassName());
      eventContainer.addMethod(info.getMethodName());
      eventContainer.addFileName(info.getFileName());
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

    if (event == null) {
      return null;
    }

    LocationInfo info = null;

    if (event.locationInformationExists()) {
      info = event.getLocationInformation();
    }

    if (event == null) {
      logger.error("Invalid rowindex=" + rowIndex);
      throw new NullPointerException("Invalid rowIndex=" + rowIndex);
    }

    switch (columnIndex + 1) {
    case ChainsawColumns.INDEX_ID_COL_NAME:

      Object id = event.getProperty(Constants.LOG4J_ID_KEY);

      if (id != null) {
        return id;
      }

      return new Integer(rowIndex);

    case ChainsawColumns.INDEX_LEVEL_COL_NAME:
      return event.getLevel();

    case ChainsawColumns.INDEX_LOGGER_COL_NAME:
      return event.getLoggerName();

    case ChainsawColumns.INDEX_TIMESTAMP_COL_NAME:
      return new Date(event.getTimeStamp());

    case ChainsawColumns.INDEX_MESSAGE_COL_NAME:
      return event.getRenderedMessage();

    case ChainsawColumns.INDEX_NDC_COL_NAME:
      return event.getNDC();

    case ChainsawColumns.INDEX_THREAD_COL_NAME:
      return event.getThreadName();

    case ChainsawColumns.INDEX_THROWABLE_COL_NAME:
      return event.getThrowableStrRep();

    case ChainsawColumns.INDEX_CLASS_COL_NAME:
      return ((info == null)
      || ((info != null) && "?".equals(info.getClassName()))) ? ""
                                                              : info
      .getClassName();

    case ChainsawColumns.INDEX_FILE_COL_NAME:
      return ((info == null)
      || ((info != null) && "?".equals(info.getFileName()))) ? ""
                                                             : info
      .getFileName();

    case ChainsawColumns.INDEX_LINE_COL_NAME:
      return ((info == null)
      || ((info != null) && "?".equals(info.getLineNumber()))) ? ""
                                                               : info
      .getLineNumber();

    case ChainsawColumns.INDEX_METHOD_COL_NAME:
      return ((info == null)
      || ((info != null) && "?".equals(info.getMethodName()))) ? ""
                                                               : info
      .getMethodName();

    default:

      if (columnIndex <= columnNames.size()) {
View Full Code Here

Examples of org.apache.log4j.spi.location.LocationInfo

        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);
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.