Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.ThrowableInformation


  @Override
  protected void subAppend(LoggingEvent event) {
    qw.write(super.layout.format(event));

    if (super.layout.ignoresThrowable()) {
      ThrowableInformation throwableInfo = event.getThrowableInformation();
      if (throwableInfo != null) {
        Throwable throwable = throwableInfo.getThrowable();
        Throwable lastThrowable = (Throwable) ERXThreadStorage.valueForKey(ERXConsoleAppender.LAST_THROWABLE_KEY);
        if (throwable != null) {
          if (lastThrowable != throwable) {
            StringWriter exceptionStringWriter = new StringWriter();
            ERXExceptionUtilities.printStackTrace(throwable, new PrintWriter(exceptionStringWriter, true));
View Full Code Here


        return new Object[0];
    }

    @Override
    public Throwable getThrowable() {
        ThrowableInformation ti = loggingEvent.getThrowableInformation();
        if (ti != null) {
            return ti.getThrowable();
        }

        return null;
    }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public void format(final LoggingEvent event, final StringBuffer toAppendTo) {
    final ThrowableInformation information = event.getThrowableInformation();

    if (information != null) {
      final String[] stringRep = information.getThrowableStrRep();

      int length = 0;

      if (option == null) {
        length = stringRep.length;
      } else if ("full".equals(option)) {
        length = stringRep.length;
      } else if ("short".equals(option)) {
        length = -1;
      } else if ("none".equals(option)) {
        return;
      } else {
        length = stringRep.length;
      }

      toAppendTo.append("\n[Exception: ");

      if (length == -1) {
        toAppendTo.append(generateAbbreviatedExceptionMessage(information.getThrowable()));
      } else {
        for (int i = 0; i < length; i++) {
          final String string = stringRep[i];
          toAppendTo.append(string).append('\n');
        }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public void format(final LoggingEvent event, final StringBuffer toAppendTo) {

    ThrowableInformation throwableInformation = event.getThrowableInformation();

    if (throwableInformation != null) {

      Throwable throwable = throwableInformation.getThrowable();

      if (throwable instanceof ApplicationExceptionInterface) {// NOPMD
        final ApplicationExceptionInterface ApplicationExceptionInterface = (ApplicationExceptionInterface) throwable;
        toAppendTo.append("[Error code: ");
        toAppendTo.append(ApplicationExceptionInterface.getErrorCode() == null ? "%NO_ERROR_CODE%" : ApplicationExceptionInterface.getErrorCode().toString());
View Full Code Here

        return new Object[0];
    }

    @Override
    public Throwable getThrowable() {
        ThrowableInformation ti = loggingEvent.getThrowableInformation();
        if (ti != null) {
            return ti.getThrowable();
        }

        return null;
    }
View Full Code Here

      loggingEvent.setTimeStamp(timeStamp);
      loggingEvent.setLevel(levelImpl);
      loggingEvent.setThreadName(threadName);
      loggingEvent.setMessage(message);
      loggingEvent.setNDC(ndc);
      loggingEvent.setThrowableInformation(new ThrowableInformation(exception));
      loggingEvent.setLocationInformation(info);
      loggingEvent.setProperties(properties);
     
      events.add(loggingEvent);
    
View Full Code Here

                            message, null);
                    event.setLocationInformation(new LocationInfo(fileName,
                            className, methodName, lineNumber));
                    properties.putAll(mdc);
                    event.setTimeStamp(timeStamp);
                    event.setThrowableInformation(new ThrowableInformation(
                            exception));

                    event.setProperties(properties);
                    event.setThreadName(threadName);
                    event.setNDC(ndc);
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void format(final LoggingEvent event, final StringBuffer toAppendTo) {
    if (maxLines != 0) {
      ThrowableInformation information = event.getThrowableInformation();

      if (information != null) {
        String[] stringRep = information.getThrowableStrRep();

        int length = stringRep.length;
        if (maxLines < 0) {
            length += maxLines;
        } else if (length > maxLines) {
View Full Code Here

    this.logger = logger;
    this.categoryName = logger.getName();
    this.level = level;
    this.message = message;
    if(throwable != null) {
      this.throwableInfo = new ThrowableInformation(throwable);
    }
    timeStamp = System.currentTimeMillis();
  }
View Full Code Here

    this.logger = logger;
    this.categoryName = logger.getName();
    this.level = level;
    this.message = message;
    if(throwable != null) {
      this.throwableInfo = new ThrowableInformation(throwable);
    }

    this.timeStamp = timeStamp;
  }
View Full Code Here

TOP

Related Classes of org.apache.log4j.spi.ThrowableInformation

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.