Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LocationInfo


      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


      }
      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

    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

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

      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

      }
      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(Transform.escapeTags(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

        newRecord.setMillis(event.getTimeStamp());
        newRecord.setThreadName(event.getThreadName());
        newRecord.setThrown(event.getThrowableInformation().getThrowable());
        newRecord.setNdc(event.getNDC());
        if (event.locationInformationExists()) {
            final LocationInfo locationInfo = event.getLocationInformation();
            newRecord.setSourceClassName(locationInfo.getClassName());
            newRecord.setSourceFileName(locationInfo.getFileName());
            newRecord.setSourceLineNumber(Integer.parseInt(locationInfo.getLineNumber()));
            newRecord.setSourceMethodName(locationInfo.getMethodName());
        }
        return newRecord;
    }
View Full Code Here

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

      }
      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(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

      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.