protected static String logException(final Throwable throwable) {
    final String msg = "Caught exception getting metrics : " + throwable.getLocalizedMessage();

    // JsonParseException includes InputStream's hash code into the message.
    // getMessage and printStackTrace returns a different String every time.
    String cacheKey = getCacheKeyForException(throwable);

    if (LOG.isDebugEnabled()) {
      LOG.debug(msg, throwable);
    } else {
      try {
        exceptionsCache.get(cacheKey, new Callable<Throwable>() {
          @Override
          public Throwable call() {
            LOG.error(msg + ", skipping same exceptions for next 5 minutes", throwable);
            return throwable;
          }
        });
      } catch (ExecutionException ignored) {
      }
    }


    return msg;
  }
Log an error for the given exception.

@param throwable  the caught exception

@return the error message that was logged
ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ThreadPoolEnabledPropertyProvider.java