Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LocationInfo


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

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

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

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

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

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


    }
    return info;
  }

  private static final LocationInfo toLocationInfo( final StackTraceElement caller ) {
    LocationInfo info = null;
    if( caller != null ) {
        info = new LocationInfo( caller.getFileName(), caller.getClassName(), caller.getMethodName(), Integer.toString(caller.getLineNumber()) );
    }
    return info;
  }
View Full Code Here

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

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

    buf.append("</log4j:event>\r\n\r\n");
View Full Code Here

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

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

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

      }
      sbuf.append( "</td>" + Layout.LINE_SEP );
    }

    if ( showCodeLineColumn() ) {
      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

    this.method = info.getMethodName();
    this.line = info.getLineNumber();
  }

  public LocationInfo toLocationInfo() {
    return new LocationInfo(file, clazz, method, line);
  }
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

     Set the location information for this logging event. The collected
     information is cached for future use.
   */
  public LocationInfo getLocationInformation() {
    if(locationInfo == null) {
      locationInfo = new LocationInfo(new Throwable(), fqnOfCategoryClass);
    }
    return locationInfo;
  }
View Full Code Here

    ois.defaultReadObject();
    readLevel(ois);

    // Make sure that no location info is available to Layouts
    if(locationInfo == null) {
        locationInfo = new LocationInfo(null, 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.