Examples of ThrowableInformation


Examples of org.apache.log4j.spi.ThrowableInformation

    root.debug("%throwable{100}, with exception", ex);

    //
    //  manufacture a pattern to get just the first two lines
    //
    String[] trace = new ThrowableInformation(ex).getThrowableStrRep();
    layout.setConversionPattern("%m%n%throwable{" + (2 - trace.length) + "}");
    layout.activateOptions();
    root.debug("%throwable{-n}, no exception");
    root.debug("%throwable{-n}, with exception", ex);
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

    public boolean requiresLayout() {
        return true;
    }

    public static Throwable getThrowable(LoggingEvent event) {
        ThrowableInformation information = event.getThrowableInformation();
        if (information != null) {
            return information.getThrowable();
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

        return StringUtility.emptyStringIfNull(log.getThreadName());
    }

    @Override
    public String getThrowableInfo() {
        ThrowableInformation throwable = log.getThrowableInformation();
        String throwableInfo = "";

        if (throwable != null) {
            throwableInfo = throwable.getThrowable().getMessage();
        }
        return throwableInfo;
    }
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

        Assert.assertEquals("DEBUG", socketLogEvent.getLevel());

        when(mockLog.getThreadName()).thenReturn("ThreadName");
        Assert.assertEquals("ThreadName", socketLogEvent.getThreadName());

        when(mockLog.getThrowableInformation()).thenReturn(new ThrowableInformation(new Throwable("Exception")));
        Assert.assertEquals("Exception", socketLogEvent.getThrowableInfo());
    }
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

        return loggingEvent.getThreadName();
    }

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

        return null;
    }
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

            String renderedMessage = event.getRenderedMessage();
            if (renderedMessage != null)
            {
                message.append(renderedMessage);
            }
            ThrowableInformation ti = event.getThrowableInformation();
            if (ti != null)
            {
                Throwable t = ti.getThrowable();
                if (t != null)
                {
                    if (message.length() > 0)
                    {
                        message.append(":");
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

  /**
   * {@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

Examples of org.apache.log4j.spi.ThrowableInformation

    root.debug("%throwable{100}, with exception", ex);

    //
    //  manufacture a pattern to get just the first two lines
    //
    String[] trace = new ThrowableInformation(ex).getThrowableStrRep();
    layout.setConversionPattern("%m%n%throwable{" + (2 - trace.length) + "}");
    layout.activateOptions();
    root.debug("%throwable{-n}, no exception");
    root.debug("%throwable{-n}, with exception", ex);
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

  }
 
  public int countExceptionsWithMessage(final String text) {
    int count = 0;
    for (LoggingEvent e: getLog()) {
      ThrowableInformation t = e.getThrowableInformation();
      if (t != null) {
        String m = t.getThrowable().getMessage();
        if (m.contains(text)) {
          count++;
        }
      }
    }
View Full Code Here

Examples of org.apache.log4j.spi.ThrowableInformation

        String text = layout.format(event);
        Throwable thrown = null;

        if (layout.ignoresThrowable()) {
            ThrowableInformation info = event.getThrowableInformation();

            if (info != null) {
                thrown = info.getThrowable();
            }
        }

        Level level = event.getLevel();
        int severity = IStatus.OK;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.