Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LocationInfo


    String logMessage = event.getRenderedMessage();
    String nestedDiagnosticContext = event.getNDC();
    String threadDescription = event.getThreadName();
    String level = event.getLevel().toString();
    long time = event.timeStamp;
    LocationInfo locationInfo = event.getLocationInformation();

    // Add the logging event information to a LogRecord
    Log4JLogRecord record = new Log4JLogRecord();

    record.setCategory(category);
View Full Code Here


      text.append(event.getThreadName());
      text.append("/");
    }

    if (mask.contains(FILE_NAME)) {
      final LocationInfo location = event.getLocationInformation();
      text.append(location.getFileName());
      text.append("/");
    }

    if (mask.contains(CLASS_NAME)) {
      final LocationInfo location = event.getLocationInformation();
      text.append(location.getClassName());
      text.append("/");
    }

    if (mask.contains(METHOD_NAME)) {
      final LocationInfo location = event.getLocationInformation();
      text.append(location.getMethodName());
      text.append("/");
    }

    if (mask.contains(LINE_NUMBER)) {
      final LocationInfo location = event.getLocationInformation();
      text.append(location.getLineNumber());
      text.append("/");
    }

    if (mask.contains(STACK_TRACE)) {
      final String[] stackArray = event.getThrowableStrRep();
View Full Code Here

      jsonGen.writeStringField(fieldMessage, event.getMessage()
          .toString());
    }

    if (shouldInclude(fieldFile)) {
      final LocationInfo location = event.getLocationInformation();
      jsonGen.writeStringField(fieldFile, location.getFileName());
    }

    if (shouldInclude(fieldClass)) {
      final LocationInfo location = event.getLocationInformation();
      jsonGen.writeStringField(fieldClass, location.getClassName());
    }

    if (shouldInclude(fieldMethod)) {
      final LocationInfo location = event.getLocationInformation();
      jsonGen.writeStringField(fieldMethod, location.getMethodName());
    }

    if (shouldInclude(fieldLine)) {
      final LocationInfo location = event.getLocationInformation();
      jsonGen.writeStringField(fieldLine, location.getLineNumber());
    }

  }
View Full Code Here

    String logMessage = event.getRenderedMessage();
    String nestedDiagnosticContext = event.getNDC();
    String threadDescription = event.getThreadName();
    String level = event.getLevel().toString();
    long time = event.timeStamp;
    LocationInfo locationInfo = event.getLocationInformation();

    // Add the logging event information to a LogRecord
    Log4JLogRecord record = new Log4JLogRecord();

    record.setCategory(category);
View Full Code Here

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

    if (properties) {
        Set keySet = event.getPropertyKeySet();
View Full Code Here

    sbuf.append("<td title=\"" + escapedLogger + " category\">");
    sbuf.append(escapedLogger);
    sbuf.append("</td>" + Layout.LINE_SEP);

    if(locationInfo) {
      LocationInfo locInfo = event.getLocationInformation();
      sbuf.append("<td>");
      sbuf.append(Transform.escapeTags(locInfo.getFileName()));
      sbuf.append(':');
      sbuf.append(locInfo.getLineNumber());
      sbuf.append("</td>" + Layout.LINE_SEP);
    }

    sbuf.append("<td title=\"Message\">");
    sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
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

      this.type = type;
    }

    public
    String convert(LoggingEvent event) {
      LocationInfo locationInfo = event.getLocationInformation();
      switch(type) {
      case FULL_LOCATION_CONVERTER:
  return locationInfo.fullInfo;
      case METHOD_LOCATION_CONVERTER:
  return locationInfo.getMethodName();
      case LINE_LOCATION_CONVERTER:
  return locationInfo.getLineNumber();
      case FILE_LOCATION_CONVERTER:
  return locationInfo.getFileName();
      default: return null;
      }
    }
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.