Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LocationInfo


     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

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

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

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

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

/* 100 */     String logMessage = event.getRenderedMessage();
/* 101 */     String nestedDiagnosticContext = event.getNDC();
/* 102 */     String threadDescription = event.getThreadName();
/* 103 */     String level = event.getLevel().toString();
/* 104 */     long time = event.timeStamp;
/* 105 */     LocationInfo locationInfo = event.getLocationInformation();
/*     */
/* 108 */     Log4JLogRecord record = new Log4JLogRecord();
/*     */
/* 110 */     record.setCategory(category);
/* 111 */     record.setMessage(logMessage);
View Full Code Here

/* 478 */       this.type = type;
/*     */     }
/*     */
/*     */     public String convert(LoggingEvent event)
/*     */     {
/* 483 */       LocationInfo locationInfo = event.getLocationInformation();
/* 484 */       switch (this.type) {
/*     */       case 1000:
/* 486 */         return locationInfo.fullInfo;
/*     */       case 1001:
/* 488 */         return locationInfo.getMethodName();
/*     */       case 1003:
/* 490 */         return locationInfo.getLineNumber();
/*     */       case 1004:
/* 492 */         return locationInfo.getFileName();
/* 493 */       case 1002: } return null;
/*     */     }
View Full Code Here

/* 156 */     this.sbuf.append("<td title=\"" + event.getLoggerName() + " category\">");
/* 157 */     this.sbuf.append(Transform.escapeTags(event.getLoggerName()));
/* 158 */     this.sbuf.append("</td>" + Layout.LINE_SEP);
/*     */
/* 160 */     if (this.locationInfo) {
/* 161 */       LocationInfo locInfo = event.getLocationInformation();
/* 162 */       this.sbuf.append("<td>");
/* 163 */       this.sbuf.append(Transform.escapeTags(locInfo.getFileName()));
/* 164 */       this.sbuf.append(':');
/* 165 */       this.sbuf.append(locInfo.getLineNumber());
/* 166 */       this.sbuf.append("</td>" + Layout.LINE_SEP);
/*     */     }
/*     */
/* 169 */     this.sbuf.append("<td title=\"Message\">");
/* 170 */     this.sbuf.append(Transform.escapeTags(event.getRenderedMessage()));
View Full Code Here

      }
      this.buf.append("]]></log4j:throwable>\r\n");
    }
    if (this.locationInfo)
    {
      LocationInfo localLocationInfo = paramLoggingEvent.getLocationInformation();
      this.buf.append("<log4j:locationInfo class=\"");
      this.buf.append(Transform.escapeTags(localLocationInfo.getClassName()));
      this.buf.append("\" method=\"");
      this.buf.append(Transform.escapeTags(localLocationInfo.getMethodName()));
      this.buf.append("\" file=\"");
      this.buf.append(localLocationInfo.getFileName());
      this.buf.append("\" line=\"");
      this.buf.append(localLocationInfo.getLineNumber());
      this.buf.append("\"/>\r\n");
    }
    this.buf.append("</log4j:event>\r\n\r\n");
    return this.buf.toString();
  }
View Full Code Here

            if (stack == null) {
                stack = element.getThrowableStrRep();
            }
            answer.setException(stack);
        }
        LocationInfo locationInformation = element.getLocationInformation();
        if (locationInformation != null) {
            answer.setFileName(locationInformation.getFileName());
            answer.setClassName(locationInformation.getClassName());
            answer.setMethodName(locationInformation.getMethodName());
            answer.setLineNumber(locationInformation.getLineNumber());
        }
        Level level = element.getLevel();
        if (level != null) {
            answer.setLevel(level.toString());
        }
View Full Code Here

        return null;
    }


    protected void appendMavenCoordinates(LoggingEvent loggingEvent) {
        LocationInfo information = loggingEvent.getLocationInformation();
        if (information != null) {
            String coordinates = MavenCoordHelper.getMavenCoordinates(information.getClassName());
            if (coordinates != null) {
                loggingEvent.setProperty("maven.coordinates", coordinates);
            }
        }
    }
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.