Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LocationInfo


    throws ScanError {
    super(operator, rightSide);
  }

  protected String getLeftSide(LoggingEvent event) {
    LocationInfo li = event.getLocationInformation();
    return li.getClassName();
  }
View Full Code Here


    throws ScanError {
    super(operator, rightSide);
  }

  protected String getLeftSide(LoggingEvent event) {
    LocationInfo li = event.getLocationInformation();
    return li.getMethodName();
  }
View Full Code Here

    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

   */
  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

          }
        }
      }
      Level levelImpl = Level.toLevel(level);
     
      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) {
          exception = new String[]{""};
View Full Code Here

            }
          }
        }
      }

      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

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

  /**
   * {@inheritDoc}
   */
  public void format(final LoggingEvent event, final StringBuffer output) {
    LocationInfo locationInfo = event.getLocationInformation();

    if (locationInfo != null) {
      output.append(locationInfo.getFileName());
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void format(final LoggingEvent event, final StringBuffer toAppendTo) {
    LocationInfo locationInfo = event.getLocationInformation();

    if (locationInfo != null) {
      toAppendTo.append(locationInfo.getMethodName());
    }
  }
View Full Code Here

    * @param event event to format.
   * @param toAppendTo string buffer to which class name will be appended.
   */
  public void format(final LoggingEvent event, final StringBuffer toAppendTo) {
    final int initialLength = toAppendTo.length();
    LocationInfo li = event.getLocationInformation();

    if (li == null) {
      toAppendTo.append(LocationInfo.NA);
    } else {
      toAppendTo.append(li.getClassName());
    }

    abbreviate(initialLength, toAppendTo);
  }
View Full Code Here

TOP

Related Classes of org.apache.log4j.spi.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.