protected void trackException(MonKey key, Throwable ex) {
String stackTrace = "stackTrace=" + Misc.getExceptionTrace(ex);
key.setDetails(stackTrace);
// Specific exception counter. Example: java.lang.RuntimeException
MonitorFactory.add(new MonKeyImp(ex.getClass().getName(), stackTrace, "Exception"), 1);
// General exception counter which is a total for all exceptions thrown
MonitorFactory.add(new MonKeyImp(MonitorFactory.EXCEPTIONS_LABEL, stackTrace, "Exception"), 1);
}