Package org.apache.log4j.spi.location

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


    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

    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

        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

      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

    properties.put(Constants.APPLICATION_KEY, fileURL);

    //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();
View Full Code Here

        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

  }

  public StringBuffer convert(LoggingEvent event) {
    buf.setLength(0);

  LocationInfo locationInfo = event.getLocationInformation();
    if (locationInfo!=null) {
      buf.append(locationInfo.getFileName());
    }

    return buf;
  }
View Full Code Here

  }

  public StringBuffer convert(LoggingEvent event) {
    buf.setLength(0);

    LocationInfo locationInfo = event.getLocationInformation();
    if (locationInfo!=null) {
      buf.append(locationInfo.getMethodName());
    }

    return buf;
  }
View Full Code Here

  public ClassNamePatternConverter() {
    super();
  }
 
  String getFullyQualifiedName(LoggingEvent event) {
    LocationInfo li = event.getLocationInformation();
    if(li == null) {
      return LocationInfo.NA;
    } else {
      return li.getClassName();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.log4j.spi.location.LocationInfo

Copyright © 2018 www.massapicom. 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.