diff --git a/CEP/Calibration/BBSControl/src/bbs-controller.cc b/CEP/Calibration/BBSControl/src/bbs-controller.cc
index e645c69d679ba9097e6ca7f28867af38e7c8de4e..06e5aa86cab979832dae637ddfdb3c62a2b2a3aa 100644
--- a/CEP/Calibration/BBSControl/src/bbs-controller.cc
+++ b/CEP/Calibration/BBSControl/src/bbs-controller.cc
@@ -133,11 +133,6 @@ int main(int argc, char *argv[])
     LOG_FATAL_STR(progName << " terminated due to an exception: " << ex);
     return 1;
   }
-  catch(...)
-  {
-    LOG_FATAL_STR(progName << " terminated due to an unknown exception.");
-    return 1;
-  }
 
   LOG_INFO_STR(progName << " terminated successfully.");
   return 0;
diff --git a/CEP/Calibration/BBSControl/src/bbs-reducer.cc b/CEP/Calibration/BBSControl/src/bbs-reducer.cc
index a38379cdda114180a7b3dd54d215d29f5d9f7194..09b65500f66ab79b9b36fe0960ed6d13dcb4496a 100644
--- a/CEP/Calibration/BBSControl/src/bbs-reducer.cc
+++ b/CEP/Calibration/BBSControl/src/bbs-reducer.cc
@@ -157,11 +157,6 @@ int main(int argc, char *argv[])
     LOG_FATAL_STR(progName << " terminated due to an exception: " << ex);
     return 1;
   }
-  catch(...)
-  {
-    LOG_FATAL_STR(progName << " terminated due to an unknown exception.");
-    return 1;
-  }
 
   LOG_INFO_STR(progName << " terminated successfully.");
   return 0;
diff --git a/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc b/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc
index 23ecf40d253a9d163178d71e479db60dd545e49d..bb45bf4be430bf6aed819a30bdc9e3f2281b6a32 100644
--- a/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc
+++ b/CEP/Calibration/BBSControl/src/bbs-shared-estimator.cc
@@ -115,11 +115,6 @@ int main(int argc, char *argv[])
     LOG_FATAL_STR(progName << " terminated due to an exception: " << ex);
     return 1;
   }
-  catch(...)
-  {
-    LOG_FATAL_STR(progName << " terminated due to an unknown exception.");
-    return 1;
-  }
 
   LOG_INFO_STR(progName << " terminated successfully.");
   return 0;
diff --git a/CEP/Calibration/BBSTools/src/patchCasaFreq.cc b/CEP/Calibration/BBSTools/src/patchCasaFreq.cc
index 3df7fd07a6f2a92efba815590982381a337b7029..6cdb17803aa42712f6a8be4bf9d53359d3478da1 100644
--- a/CEP/Calibration/BBSTools/src/patchCasaFreq.cc
+++ b/CEP/Calibration/BBSTools/src/patchCasaFreq.cc
@@ -8,6 +8,7 @@
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>   // for ASSERT and ASSERTSTR?
 #include <Common/SystemUtil.h>    // needed for basename
+#include <Common/Exception.h>
 
 // STL/C++ includes
 #include <iostream>
@@ -41,6 +42,8 @@ using namespace std;
 using namespace casa;
 using namespace LOFAR;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
 
 double patchImageFreq(const string &imageName, double reffreq);
 void usage(const char *programname);
@@ -53,7 +56,7 @@ int main(int argc, char **argv)
   if(argc < 3)        // if not enough parameters given, display usage information
   {
       usage(argv[0]);
-      exit(0);
+      return 0;
   }
   else      // Handle file arguments: MS image image (and options, e.g. -w 512)
   {
@@ -66,7 +69,7 @@ int main(int argc, char **argv)
       originalfrequency << " Hz)" << endl;
   }
 
-  exit(0);
+  return 0;
 }
 
 
@@ -112,4 +115,4 @@ double patchImageFreq(const string &imageName, double reffreq)
 void usage(const char *programname)
 {
   cout << "Usage: " << programname << "<imagename> <patchfrequency>" << endl;
-}
\ No newline at end of file
+}
diff --git a/CEP/Imager/LofarFT/src/awimager.cc b/CEP/Imager/LofarFT/src/awimager.cc
index 2965be7e49ef2aae93f54040377cc9cf0d25e210..28a106f40a944453d81606b1191efd22a314a81b 100644
--- a/CEP/Imager/LofarFT/src/awimager.cc
+++ b/CEP/Imager/LofarFT/src/awimager.cc
@@ -27,6 +27,7 @@
 
 //# Includes
 #include <lofar_config.h>
+#include <LofarFT/Exceptions.h>
 #include <LofarFT/LofarImager.h>
 #include <LofarFT/Package__Version.h>
 #include <Common/InputParSet.h>
@@ -63,7 +64,7 @@ IPosition handlePos (const IPosition& pos, const IPosition& def)
     return def;
   }
   if (pos.nelements() != 2) {
-    throw AipsError("Give 0 or 2 values in maskblc and masktrc");
+    THROW(AWImagerException, "Give 0 or 2 values in maskblc and masktrc");
   }
   IPosition npos(def);
   int n = npos.nelements();
@@ -90,7 +91,7 @@ Quantity readQuantity (const String& in)
 {
   Quantity res;
   if (!Quantity::read(res, in)) {
-    throw AipsError (in + " is an illegal quantity");
+    THROW(AWImagerException, in << " is an illegal quantity");
   }
   return res;
 }
@@ -99,12 +100,12 @@ MDirection readDirection (const String& in)
 {
   Vector<String> vals = stringToVector(in);
   if (vals.size() > 3) {
-    throw AipsError ("MDirection value " + in + " is invalid;"
+    THROW(AWImagerException, "MDirection value " << in << " is invalid;"
 		     " up to 3 values can be given");
   }
   MDirection::Types tp;
   if (! MDirection::getType (tp, vals[0])) {
-    throw AipsError(vals[0] + " is an invalid MDirection type");
+    THROW(AWImagerException, vals[0] << " is an invalid MDirection type");
   }
   Quantity v0(0, "deg");
   Quantity v1(90, "deg");     // same default as in measures.g
@@ -125,7 +126,7 @@ void readFilter (const String& filter,
   }
   Vector<String> strs = stringToVector(filter);
   if (strs.size() != 3) {
-    throw AipsError("Specify gaussian tapering filter as bmajor,bminor,bpa");
+    THROW(AWImagerException, "Specify gaussian tapering filter as bmajor,bminor,bpa");
   }
   if (! strs[0].empty()) {
     bmajor = readQuantity (strs[0]);
@@ -154,7 +155,7 @@ Matrix<Bool> readMueller (const String& str, String stokes, Bool grid)
     if (s == "BAND1") {
       mat(0,3) = mat(1,4) = mat(3,0) = mat(4,1) = False;
     } else if (s != "BAND2") {
-      throw AipsError (str + " is an invalid Mueller specification");
+      THROW(AWImagerException, str << " is an invalid Mueller specification");
     }
   }
   if((stokes=="I")&&(grid)){
@@ -575,7 +576,7 @@ int main(int argc, char *argv[])
     // Check and interpret input values.
     Quantity qcellsize = readQuantity (cellsize);
     if (msName.empty()) {
-      throw AipsError("An MS name must be given like ms=test.ms");
+      THROW(AWImagerException, "An MS name must be given like ms=test.ms");
     }
     imageType.downcase();
     if (imageType == "data") {
@@ -836,7 +837,7 @@ int main(int argc, char *argv[])
                                                  fitsName,
                                                  64,         // memoryInMB
                                                  preferVelocity)) {
-            throw AipsError(error);
+            THROW(AWImagerException, error);
           }
         }
 
@@ -994,7 +995,7 @@ int main(int argc, char *argv[])
                                                  fitsName,
                                                  64,         // memoryInMB
                                                  preferVelocity)) {
-            throw AipsError(error);
+            THROW(AWImagerException, error);
           }
         }
       }
diff --git a/CEP/Imager/LofarFT/src/makefftwisdom2d.cc b/CEP/Imager/LofarFT/src/makefftwisdom2d.cc
index 9259136d5bec368bcd3a3122b08743c6ef858d6a..0b462eba241eb6ace7da8423eb10151325a1c894 100644
--- a/CEP/Imager/LofarFT/src/makefftwisdom2d.cc
+++ b/CEP/Imager/LofarFT/src/makefftwisdom2d.cc
@@ -23,6 +23,7 @@
 #include <lofar_config.h>
 #include <LofarFT/FFTCMatrix.h>
 #include <Common/lofar_iostream.h>
+#include <Common/Exception.h>
 #include <casa/OS/Path.h>
 #include <stdio.h>
 #include <errno.h>
@@ -30,6 +31,9 @@
 
 using namespace LOFAR;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 void showhelp()
 {
   cout << endl;
diff --git a/CEP/ParmDB/src/parmdbm.cc b/CEP/ParmDB/src/parmdbm.cc
index 7429d34e5c194aea6a21ed3c1f6404e88a94d3cf..13e29cfb30bb62a22d85d53858d966bae872a833 100644
--- a/CEP/ParmDB/src/parmdbm.cc
+++ b/CEP/ParmDB/src/parmdbm.cc
@@ -956,8 +956,8 @@ void doIt (bool noPrompt, ostream& ostr)
           }
         }
       }
-    } catch (std::exception& x) {
-      cerr << "Exception: " << x.what() << endl;
+    } catch (Exception& ex) {
+      cerr << ex << endl;
     }
   }
   delete parmtab;
@@ -978,8 +978,8 @@ int main (int argc, char *argv[])
     }
     // Print an extra line to be sure the shell prompt is at a new line.
     cout << endl;
-  } catch (std::exception& x) {
-    cerr << "Caught exception: " << x.what() << endl;
+  } catch (Exception& ex) {
+    cerr << ex << endl;
     return 1;
   }
   
diff --git a/CEP/ParmDB/src/parmexportcal.cc b/CEP/ParmDB/src/parmexportcal.cc
index 3d44c8abed658fda137f79384d275f57937be072..8d7e576107575efcd06c25601efea1c49286b02b 100644
--- a/CEP/ParmDB/src/parmexportcal.cc
+++ b/CEP/ParmDB/src/parmexportcal.cc
@@ -286,8 +286,8 @@ int main (int argc, char *argv[])
     }
     // Do the export.
     doIt (nameIn, nameOut, append, skipLast, amplPerc, parmType);
-  } catch (std::exception& x) {
-    cerr << "Caught exception: " << x.what() << endl;
+  } catch (Exception& ex) {
+    cerr << ex << endl;
     return 1;
   }
   
diff --git a/LCS/AMC/AMCImpl/src/WGS84toITRF.cc b/LCS/AMC/AMCImpl/src/WGS84toITRF.cc
index a3c06f637421475758812301157c74444104688d..134d5510ea24b29eaf2dbcf6f52bdd563374c00d 100644
--- a/LCS/AMC/AMCImpl/src/WGS84toITRF.cc
+++ b/LCS/AMC/AMCImpl/src/WGS84toITRF.cc
@@ -78,8 +78,8 @@ int main()
       pos = conv(pos);
       showPos(pos);
     }
-  } catch (exception& e) {
-    cerr << "Exception: " << e.what() << endl;
+  } catch (Exception& e) {
+    cerr << e << endl;
     return 1;
   }
   return 0;
diff --git a/LCS/Common/include/Common/Exceptions.h b/LCS/Common/include/Common/Exceptions.h
index 4d3d36701a35c56a1c3e7b32f81114cffd9a4302..5ecdbc3dea7ee50ec46af955d30026b8991230d8 100644
--- a/LCS/Common/include/Common/Exceptions.h
+++ b/LCS/Common/include/Common/Exceptions.h
@@ -1,4 +1,4 @@
-//# Exceptions.h: Declaration and definition of SINFONI specific exceptions.
+//# Exceptions.h: Declaration and definition of common LOFAR exceptions.
 //#
 //# Copyright (C) 2002-2006
 //# ASTRON (Netherlands Institute for Radio Astronomy)
@@ -31,7 +31,7 @@ namespace LOFAR
   //
   // This exception will be thrown when an assertion fails.
   //
-  EXCEPTION_CLASS(AssertError,Exception);
+  EXCEPTION_CLASS(AssertError, Exception);
 
   //
   // This exception will be thrown when an I/O error occurs.
@@ -55,6 +55,6 @@ namespace LOFAR
   //
   EXCEPTION_CLASS(APSException, Exception);
 
-} // namespace ASTRON
+} // namespace LOFAR
 
 #endif
diff --git a/MAC/APL/Appl_Controller/ACcli.cc b/MAC/APL/Appl_Controller/ACcli.cc
index 5c477c2b42afc729d94ddf97714a1fc45ae270af..dfcf191d466ee9de5d352658c49834c534b1341f 100644
--- a/MAC/APL/Appl_Controller/ACcli.cc
+++ b/MAC/APL/Appl_Controller/ACcli.cc
@@ -22,12 +22,15 @@
 
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 #include <ALC/ACSyncClient.h>
 
 using namespace LOFAR;
 using namespace LOFAR::ACC;
 using namespace LOFAR::ACC::ALC;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
 
 void printUsage() {
   cout << "This program is a commandline client to ACC. It can be used from shell scripts." << endl;
diff --git a/MAC/APL/Appl_Controller/ACuserMenu.cc b/MAC/APL/Appl_Controller/ACuserMenu.cc
index 999b10c58fc66b8a06fe2b0cd4998328c374d372..434111e61c1a0b345972c6ce01da0137cf3e6881 100644
--- a/MAC/APL/Appl_Controller/ACuserMenu.cc
+++ b/MAC/APL/Appl_Controller/ACuserMenu.cc
@@ -25,6 +25,7 @@
 
 #include <Common/LofarLogger.h>
 #include <Common/LofarLocators.h>
+#include <Common/Exception.h>
 #include <Common/hexdump.h>
 #include <Common/StringUtil.h>
 #include <ALC/ACSyncClient.h>
@@ -35,6 +36,9 @@ using namespace LOFAR;
 using namespace LOFAR::ACC;
 using namespace LOFAR::ACC::ALC;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 myACClientFunctions		myACF;
 ApplControlClient*		ACClient    = 0;
 bool					connected   = false;
diff --git a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc
index eeb52b7cdf1823476769753232bc4d0bac10f829..df9cc9d495ec230db03a9cd210a245f3412f70f5 100644
--- a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc
+++ b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc
@@ -22,12 +22,16 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "OnlineControl.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::CEPCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname
diff --git a/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc b/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc
index 40f8883263e627c26d8434ffd8468a31a258234b..16c67c5d9ec0a8a31e1dfd97c9b8e8d0f28f832a 100644
--- a/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc
+++ b/MAC/APL/CEPCU/src/PythonControl/PythonControlMain.cc
@@ -22,12 +22,16 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "PythonControl.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::CEPCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname
diff --git a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc
index e6f39a6ecdbe63373bf38dc3235b8b9183ab177c..d78c0e9c4784d7c5a2554f017e6ccfd2a60fde8b 100644
--- a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc
+++ b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc
@@ -21,12 +21,16 @@
 //#  $Id$
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 #include <signal.h>
 
 #include "CTStartDaemon.h"
 
 using namespace LOFAR;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 //	signal (SIGCHLD, SIG_IGN);
diff --git a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc
index ad70a6ec8962caffb07e67c44c7c67b430c09ce6..cc23478288b343a04a449c0f6131eeba52bdf26b 100644
--- a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc
+++ b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc
@@ -22,6 +22,7 @@
 
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include <ServiceBroker.h>
 #include <GCF/TM/GCF_Control.h>
@@ -30,6 +31,9 @@ using namespace LOFAR;
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::CUDaemons;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char *argv[])
 {
   GCFScheduler::instance()->init(argc, argv, "ServiceBroker");
diff --git a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc
index d6bbc92522ec700dac8d775acb9017f885bf5985..8bc5fdcbe7cef831021d138ac7552ee555cd9764 100644
--- a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc
@@ -23,11 +23,15 @@
 #include <lofar_config.h>
 
 #include <GCF/TM/GCF_Control.h>
+#include <Common/Exception.h>
 #include "KeyValueLogger.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::GCF::RTDBDaemons;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char *argv[])
 {
 	GCFScheduler::instance()->init(argc, argv, "KeyValueLogger");
diff --git a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc
index a8bb97daa5850d3cd72590142fd262e0c13b5cd6..7c9e2a7dfb1d6e01e2425955ff0ba2f51ee9c5ac 100644
--- a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc
@@ -23,11 +23,15 @@
 #include <lofar_config.h>
 
 #include <GCF/TM/GCF_Control.h>
+#include <Common/Exception.h>
 #include "LogProcessor.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::GCF::RTDBDaemons;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char *argv[])
 {
 	GCFScheduler::instance()->init(argc, argv, "LogProcessor");
diff --git a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc
index 34035d6f653784a59d91223525815ee239b60237..57bf6d58a8cc95c7f570ba62729745879fa872cc 100644
--- a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc
@@ -23,11 +23,15 @@
 #include <lofar_config.h>
 
 #include <GCF/TM/GCF_Control.h>
+#include <Common/Exception.h>
 #include "SASGateway.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::GCF::RTDBDaemons;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char *argv[])
 {
 	GCFScheduler::instance()->init(argc, argv, "SASGateway");
diff --git a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc
index ff5e5c53dda5a15cd2eb24056719968a92aaecc2..a1c9969cd39aefcf263acc2452843d0a418c049a 100644
--- a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc
@@ -24,6 +24,7 @@
 #include <Common/LofarLogger.h>
 #include <Common/Version.h>
 #include <Common/ParameterSet.h>
+#include <Common/Exception.h>
 
 #include <GCF/RTDB/DP_Protocol.ph>
 #include "SoftwareMonitor.h"
@@ -34,6 +35,9 @@ using namespace LOFAR::GCF;
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::RTDBDaemons;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
diff --git a/MAC/APL/Log_Client/src/LogClientMain.cc b/MAC/APL/Log_Client/src/LogClientMain.cc
index 277bab835f415267fbed5cfbd1fca449cf6a2c6d..a05d699b499e939669eb79d3c1d63130c3c27d21 100644
--- a/MAC/APL/Log_Client/src/LogClientMain.cc
+++ b/MAC/APL/Log_Client/src/LogClientMain.cc
@@ -23,11 +23,16 @@
 #include <lofar_config.h>
 
 #include <GCF/TM/GCF_Control.h>
+#include <Common/Exception.h>
 #include "LogClient.h"
 
+using namespace LOFAR;
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::Log_Client;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char *argv[])
 {
 	GCFScheduler::instance()->init(argc, argv, "LogClient");
diff --git a/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc b/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc
index 41c37901e7c75c34482b2d5a209316a798a71524..1158c2e0eb1d3ad1e8803a3a57631a20622068f4 100644
--- a/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc
+++ b/MAC/APL/MainCU/src/CRTriggerControl/TriggerControlMain.cc
@@ -22,12 +22,16 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "TriggerControl.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::MainCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	
diff --git a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc
index 0c1669797489954a366cb23351cd9294c242486c..5c481059babb317ccb95492af15e58140ff0316e 100644
--- a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc
+++ b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc
@@ -22,6 +22,7 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "MACScheduler.h"
 
@@ -29,6 +30,9 @@ using namespace LOFAR::GCF::TM;
 using namespace LOFAR::MainCU;
 using namespace LOFAR::APLCommon;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	GCFScheduler::instance()->init(argc, argv, "MACScheduler");
diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc
index 367967ec07b6fb14c07452ea417342cbd2412a1f..9191d0b3f1c6d7f72d351f28717ebe3448c0b6ba 100644
--- a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc
+++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc
@@ -22,6 +22,7 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "ObservationControl.h"
 
@@ -29,6 +30,9 @@ using namespace LOFAR::GCF::TM;
 using namespace LOFAR::MainCU;
 using namespace LOFAR::APLCommon;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
diff --git a/MAC/APL/PAC/Cal_Server/src/calinfo.cc b/MAC/APL/PAC/Cal_Server/src/calinfo.cc
index 6e651c4f8d4c15ab8fb1e07862d7cefe9d6cfb85..0f01a7cdd5524cbdb3e6a06c8cb31af4ab1d5047 100644
--- a/MAC/APL/PAC/Cal_Server/src/calinfo.cc
+++ b/MAC/APL/PAC/Cal_Server/src/calinfo.cc
@@ -26,6 +26,7 @@
 //# Includes
 #include <Common/LofarLogger.h>
 #include <Common/StringUtil.h>
+#include <Common/Exception.h>
 #include <APL/CAL_Protocol/CAL_Protocol.ph>
 #include <MACIO/MACServiceInfo.h>
 #include "calinfo.h" 
@@ -136,6 +137,9 @@ using namespace LOFAR::GCF;
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::CAL;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int	argc,	char*	argv[])
 {
 	string	saName;
diff --git a/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc b/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc
index eb39f972ecf75dac3e7d1933876ddf77d1a7353f..00a98634007329dcf83ccfce4d7f862ff382e00a 100644
--- a/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc
+++ b/MAC/APL/PAC/ITRFBeamServer/src/BeamServerMain.cc
@@ -22,6 +22,7 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "BeamServer.h"
 
@@ -29,6 +30,9 @@ using namespace LOFAR;
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::BS;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
diff --git a/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc b/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc
index a18290c3c9e12508cdec847cc3f3cd3fb585f6b7..6e1ea2451f0a2e980af36df647a80a2b8309c458 100644
--- a/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc
+++ b/MAC/APL/PAC/ITRFCalServer/src/calinfo.cc
@@ -26,6 +26,7 @@
 //# Includes
 #include <Common/LofarLogger.h>
 #include <Common/StringUtil.h>
+#include <Common/Exception.h>
 #include <APL/ICAL_Protocol/ICAL_Protocol.ph>
 #include <MACIO/MACServiceInfo.h>
 #include "calinfo.h" 
@@ -137,6 +138,9 @@ using namespace LOFAR::GCF;
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::ICAL;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int	argc,	char*	argv[])
 {
 	string	saName;
diff --git a/MAC/APL/RTDBCommon/src/setObjectState.cc b/MAC/APL/RTDBCommon/src/setObjectState.cc
index 292f26bf2b2e24af0329fd28e67c3d8991896a28..ecece1201ea0ab4f31d142d262e982c5806d303e 100644
--- a/MAC/APL/RTDBCommon/src/setObjectState.cc
+++ b/MAC/APL/RTDBCommon/src/setObjectState.cc
@@ -23,6 +23,7 @@
 
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 #include <Common/lofar_fstream.h>
 #include <GCF/PVSS/GCF_PVTypes.h>
 #include <GCF/RTDB/DPservice.h>
@@ -194,6 +195,9 @@ using namespace LOFAR;
 using namespace LOFAR::GCF;
 using namespace LOFAR::APL::RTDBCommon;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	if (argc != 3 && argc != 4) {
diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc
index e309ff0d9acfd30213827a85aa87a0a348357045..c842e8ec9bf8cdd7ffa5dda12e8247ee3711152a 100644
--- a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc
+++ b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc
@@ -22,12 +22,15 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
-
+#include <Common/Exception.h>
 #include "BeamControl.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::StationCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc
index d78ef29546afc30c2911f5f1ab0f5bfdccaa6ea5..0d2db57278011f636084d976c0daa6dc450d3be9 100644
--- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc
+++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc
@@ -22,12 +22,15 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
-
+#include <Common/Exception.h>
 #include "CalibrationControl.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::StationCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
diff --git a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc
index ff30754e77e30551be5f97478fc7fc9185943ed5..8c0d8722719efd2d2c657cf68a964a03eee1020b 100644
--- a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc
+++ b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc
@@ -22,12 +22,16 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "ClockControl.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::StationCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	if (argc < 3) {
diff --git a/MAC/APL/StationCU/src/ClockControl/clkctl.cc b/MAC/APL/StationCU/src/ClockControl/clkctl.cc
index c4442081101c90b3a567bcbe0f7b6baac8299fb1..8b01db1c409d29887fd2fb8f5849d3ab780bdaab 100644
--- a/MAC/APL/StationCU/src/ClockControl/clkctl.cc
+++ b/MAC/APL/StationCU/src/ClockControl/clkctl.cc
@@ -22,6 +22,7 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 #include <MACIO/MACServiceInfo.h>
 #include "Clock_Protocol.ph"
 
@@ -170,6 +171,9 @@ void ClkCtl::doHelp()
 using namespace LOFAR;
 using namespace LOFAR::GCF::TM;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	if (argc < 2) {
diff --git a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc
index 3ea35f5a1621deb5c7a5cc63aaa6619409b35786..f671ca5b3a421f529ff1bbb7034bdcf2c5824f7d 100644
--- a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc
+++ b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc
@@ -23,7 +23,7 @@
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
 #include <Common/Version.h>
-
+#include <Common/Exception.h>
 #include <Common/ParameterSet.h>
 #include <APL/RSP_Protocol/RSP_Protocol.ph>
 #include <GCF/RTDB/DP_Protocol.ph>
@@ -37,6 +37,9 @@ using namespace LOFAR::GCF;
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::StationCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
diff --git a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc
index 38ff113ea9e627c501b9ae2e5eaa6a946e4f8969..9773aeab40014c879ed669504914f30d1c0996ac 100644
--- a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc
+++ b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc
@@ -22,6 +22,7 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 #include <Common/SystemUtil.h>
 #include <APL/APLCommon/ChildControl.h>
 #include <APL/APLCommon/ParentControl.h>
@@ -33,6 +34,9 @@ using namespace LOFAR::GCF::TM;
 using namespace LOFAR::APLCommon;
 using namespace LOFAR::StationCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	using LOFAR::basename;
diff --git a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc
index 18fd7601624138366a3f864c9b1695b81f8b7836..e1efb83bb13a2ad7adff122e00a7ab34d8ec70d5 100644
--- a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc
+++ b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc
@@ -22,12 +22,15 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
-
+#include <Common/Exception.h>
 #include "TBBControl.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::StationCU;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
diff --git a/MAC/APL/TestCtlr/src/CodeLoggingTest.cc b/MAC/APL/TestCtlr/src/CodeLoggingTest.cc
index 546da5e6e501359e160248563cc64e0b0b1c726e..b0d6efa9a777f3a48570cd2653de14714a45d7fb 100644
--- a/MAC/APL/TestCtlr/src/CodeLoggingTest.cc
+++ b/MAC/APL/TestCtlr/src/CodeLoggingTest.cc
@@ -23,12 +23,18 @@
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
 #include <Common/SystemUtil.h>
+#include <Common/Exception.h>
 
 #include <time.h>
 #include <unistd.h>
 #include <cstdio>
 #include <cstring>
 
+using namespace LOFAR;
+
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main(int argc, char* argv[])
 {
 	if (argc != 2) {
diff --git a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
index c0f9b369f3677b079d8dddf9c292040d63e9cf17..6f0598b4828fcde7436966e92ce16c10112c27b5 100644
--- a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
+++ b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
@@ -22,11 +22,16 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "ControllerMenu.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::Test;
+using namespace LOFAR;
+
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
 
 int main(int argc, char* argv[])
 {
diff --git a/MAC/APL/TestCtlr/src/TestControllerMain.cc b/MAC/APL/TestCtlr/src/TestControllerMain.cc
index fe7bc45c6c40670b2136e060aecc4b1dabefea32..9d1dfb04def8f108423a951d2a1e0d0e06da642d 100644
--- a/MAC/APL/TestCtlr/src/TestControllerMain.cc
+++ b/MAC/APL/TestCtlr/src/TestControllerMain.cc
@@ -22,11 +22,16 @@
 //#
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/Exception.h>
 
 #include "TestController.h"
 
 using namespace LOFAR::GCF::TM;
 using namespace LOFAR::Test;
+using namespace LOFAR;
+
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
 
 int main(int argc, char* argv[])
 {
diff --git a/RTCP/LofarStMan/src/fixlsmeta.cc b/RTCP/LofarStMan/src/fixlsmeta.cc
index 7e94dc13e15d3bf9284d666b7f69074229716912..4ce99510fef4bf835b87299d50bf7f6e6b704e33 100644
--- a/RTCP/LofarStMan/src/fixlsmeta.cc
+++ b/RTCP/LofarStMan/src/fixlsmeta.cc
@@ -33,6 +33,9 @@
 using namespace casa;
 using namespace LOFAR;
 
+// Use a terminate handler that can produce a backtrace.
+Exception::TerminateHandler t(Exception::terminate);
+
 int main (int argc, char* argv[])
 {
   try {