Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-453

java.lang.NullPointerException in ThrowableProxyUtil.java:42

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • None
    • 0.9.24
    • logback-classic
    • None
    • IDE WebSphere 6.1 , IBM JDK 1.5

    Description

      test example
      import org.slf4j.LoggerFactory;
      
      public class TestLogBack {
      
      	public TestLogBack() {
      		super();
      	}
      
      	public static void main(String[] args) {
      		TestLogBack test = new TestLogBack();
      		test.execute();
      	}
      
      	private void execute() {
      		org.slf4j.Logger logger = LoggerFactory.getLogger(TestLogBack.class);
      		//test
      		try {
      			throw new TestLogBackException("Test: getStackTrace() return null"); //$NON-NLS-1$
      		} catch (Throwable t) {
      			logger.error("Messaggio di Test di {}", t.getMessage(), t); //$NON-NLS-1$
      		}
      	}
      
      	class TestLogBackException
      			extends Exception {
      
      		private static final long serialVersionUID = 1L;
      
      		public TestLogBackException(String message) {
      			super(message);
      		}
      
      		@Override
      		public StackTraceElement[] getStackTrace() {
      			return null;
      		}
      	}
      
      }
      
      exception stack trace
      Exception in thread "main" java.lang.NullPointerException
      	at ch.qos.logback.classic.spi.ThrowableProxyUtil.steArrayToStepArray(ThrowableProxyUtil.java:42)
      	at ch.qos.logback.classic.spi.ThrowableProxy.<init>(ThrowableProxy.java:35)
      	at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:123)
      	at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:469)
      	at ch.qos.logback.classic.Logger.filterAndLog_2(Logger.java:462)
      	at ch.qos.logback.classic.Logger.error(Logger.java:580)
      	at z_prove.logback.TestLogBack.execute(TestLogBack.java:28)
      	at z_prove.logback.TestLogBack.main(TestLogBack.java:13)
      

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            lucianotrue Luciano Canè
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: