Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LocationInfo


      }
      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


    }

    @Override
    public String getSourceClassName() {

        LocationInfo locationInfo = loggingEvent.getLocationInformation();
        if (locationInfo != null) {
            return locationInfo.getClassName();
        }
        return "";
    }
View Full Code Here

        return "";
    }

    @Override
    public String getSourceMethodName() {
        LocationInfo locationInfo = loggingEvent.getLocationInformation();
        if (locationInfo != null) {
            return locationInfo.getMethodName();
        }
        return "";
    }
View Full Code Here

              //
              //     location info unless suppressed
              //
              //
              if (locationInfo) {
                LocationInfo locationInfo = event.getLocationInformation();
                attrs.addAttribute(null, "class", "class", "CDATA",
                        locationInfo.getClassName());
                attrs.addAttribute(null, "method", "method", "CDATA",
                          locationInfo.getMethodName());
                attrs.addAttribute(null, "file", "file", "CDATA",
                            locationInfo.getFileName());
                attrs.addAttribute(null, "line", "line", "CDATA",
                            locationInfo.getLineNumber());
                transformer.startElement(LOG4J_NS, "locationInfo",
                        "locationInfo", attrs);
                transformer.endElement(LOG4J_NS, "locationInfo",
                        "locationInfo");
              }
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

      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

    String logMessage = event.getRenderedMessage();
    String nestedDiagnosticContext = event.getNDC();
    String threadDescription = event.getThreadName();
    String level = event.level.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.categoryName + " category\">");
    sbuf.append(Transform.escapeTags(event.categoryName));
    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(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

      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

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.