You are viewing a plain text version of this content. The canonical link for it is here.
Posted to devnull@infra.apache.org by vl...@apache.org on 2019/06/08 18:42:07 UTC
[jmeter] 03/47: Ensure uncaught exceptions are logged
This is an automated email from the ASF dual-hosted git repository.
vladimirsitnikov pushed a commit to annotated tag v2_3
in repository https://gitbox.apache.org/repos/asf/jmeter.git
commit cf0fc036658aa6f8e853fd69888a64a9ac4b506b
Author: Sebastian Bazley <se...@apache.org>
AuthorDate: Tue Sep 11 20:27:02 2007 +0000
Ensure uncaught exceptions are logged
git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/branches/rel-2-2@574689 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: 59fadd0d6b1b922e2f58a716520f0434d071420f
---
.../org/apache/jmeter/engine/StandardJMeterEngine.java | 16 +++++++++++++++-
xdocs/changes.xml | 1 +
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java b/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
index b4c4b96..422fad6 100644
--- a/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
+++ b/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
@@ -176,9 +176,23 @@ public class StandardJMeterEngine implements JMeterEngine, JMeterThreadMonitor,
getTestTree().traverse(compiler);
}
+ // TODO: in Java1.5, perhaps we can use Thread.setUncaughtExceptionHandler() instead
+ private static class MyThreadGroup extends java.lang.ThreadGroup{
+ public MyThreadGroup(String s) {
+ super(s);
+ }
+
+ public void uncaughtException(Thread t, Throwable e) {
+ if (!(e instanceof ThreadDeath)) {
+ log.error("Uncaught exception: ", e);
+ System.err.println("Uncaught Exception " + e + ". See log file for details.");
+ }
+ }
+
+ }
public void runTest() throws JMeterEngineException {
try {
- runningThread = new Thread(this);
+ runningThread = new Thread(new MyThreadGroup("JMeterThreadGroup"),this);
runningThread.start();
} catch (Exception err) {
stopTest();
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index d4c8321..1b6192b 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -44,6 +44,7 @@
<li>Add nameSpace option to XPath extractor</li>
<li>Add NULL parameter option to JDBC sampler</li>
<li>Add documentation links for Rhino and BeanShell to functions; clarify variables and properties</li>
+<li>Ensure uncaught exceptions are logged</li>
</ul>
<h4>Fixes since 2.3RC3</h4>