Package org.apache.log4j.spi.location

Examples of org.apache.log4j.spi.location.LocationInfo


  }

  public StringBuffer convert(LoggingEvent event) {
    buf.setLength(0);

    LocationInfo locationInfo = event.getLocationInformation();
    if (locationInfo!=null) {
      buf.append(locationInfo.getLineNumber());
    }

    return buf;
  }
View Full Code Here


          }
        }
      }
      Level levelImpl = Level.toLevel(level);
     
      LocationInfo info = null;
      if ((fileName != null) || (className != null) || (methodName != null) || (lineNumber != null)) {
          info = new LocationInfo(fileName, className, methodName, lineNumber);
      } else {
        info = LocationInfo.NA_LOCATION_INFO;
      }
      if (exception == null) {
          exception = new String[]{""};
View Full Code Here

  }

  public StringBuffer convert(LoggingEvent event) {
    buf.setLength(0);

    LocationInfo locationInfo = event.getLocationInformation();
    if (locationInfo!=null) {
      buf.append(locationInfo.getFullInfo());
    }

    return buf;
  }
View Full Code Here

    Logger logger = Logger.getLogger(event.getLoggerName());
    String threadName = event.getThreadName();
    Object msg = escape(event.getMessage().toString());
    String ndc = event.getNDC();
//    Hashtable mdc = formatMDC(event);
    LocationInfo li = null;
    if (event.locationInformationExists()) {
        li = formatLocationInfo(event);
    }
    Hashtable properties = formatProperties(event);
    LoggingEvent copy = new LoggingEvent();
View Full Code Here

  /**
   * @param event
   * @return
   */
  private static LocationInfo formatLocationInfo(LoggingEvent event) {
    LocationInfo info = event.getLocationInformation();
    LocationInfo newInfo =
      new LocationInfo(
        escape(info.getFileName()), escape(info.getClassName()),
        escape(info.getMethodName()), escape(info.getLineNumber()));

    return newInfo;
  }
View Full Code Here

    Hashtable hashTable = new Hashtable();
    hashTable.put("key1", "val1");
    hashTable.put("key2", "val2");
    hashTable.put("key3", "val3");

    LocationInfo li =
      new LocationInfo(
        "myfile.java", "com.mycompany.util.MyClass", "myMethod", "321");

    ThrowableInformation tsr = new ThrowableInformation(new Exception());

    event = new LoggingEvent();
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

          }
        }
      }
      Level levelImpl = Level.toLevel(level);
     
      LocationInfo info = null;
      if ((fileName != null) || (className != null) || (methodName != null) || (lineNumber != null)) {
          info = new LocationInfo(fileName, className, methodName, lineNumber);
      } else {
        info = LocationInfo.NA_LOCATION_INFO;
      }
      if (exception == null) {
          exception = new String[]{""};
View Full Code Here

TOP

Related Classes of org.apache.log4j.spi.location.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.