Issue #2542 - Log exception stackTraces instead of printing

replaces some usages of printStackTrace with logging in ConnectorTimeoutTest to avoid printing out the stack trace on passing tests

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2018-05-23 07:39:23 +10:00
parent 04c1447f88
commit 0664893022
1 changed files with 20 additions and 4 deletions

View File

@ -43,6 +43,8 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.toolchain.test.AdvancedRunner;
import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.hamcrest.Matchers;
import org.junit.Assert;
@ -55,6 +57,8 @@ import org.junit.runner.RunWith;
@RunWith(AdvancedRunner.class)
public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
{
protected static final Logger LOG = Log.getLogger(ConnectorTimeoutTest.class);
@Rule
public TestTracker tracker = new TestTracker();
@ -610,11 +614,17 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
}
catch(SSLException e)
{
e.printStackTrace();
if(LOG.isDebugEnabled())
LOG.debug(e);
else
LOG.info(e.getMessage());
}
catch(Exception e)
{
e.printStackTrace();
if(LOG.isDebugEnabled())
LOG.debug(e);
else
LOG.info(e.getMessage());
}
Assert.assertTrue(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - start < maximumTestRuntime);
@ -639,11 +649,17 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
}
catch(SSLException e)
{
e.printStackTrace();
if(LOG.isDebugEnabled())
LOG.debug(e);
else
LOG.info(e.getMessage());
}
catch(Exception e)
{
e.printStackTrace();
if(LOG.isDebugEnabled())
LOG.debug(e);
else
LOG.info(e.getMessage());
}
Assert.assertTrue(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - start < maximumTestRuntime);