Skip to content

Instantly share code, notes, and snippets.

@yanhua365
Created June 23, 2014 08:37
Show Gist options
  • Save yanhua365/58ed92e0686dd5aec38a to your computer and use it in GitHub Desktop.
Save yanhua365/58ed92e0686dd5aec38a to your computer and use it in GitHub Desktop.
当出现异常的时候,根据是否是debug来决定是否打印异常
StringBuilder msg = new StringBuilder();
msg.append("Could not refresh JMS Connection for destination '");
msg.append(getDestinationDescription()).append("' - retrying in ");
msg.append(this.recoveryInterval).append(" ms. Cause: ");
msg.append(ex instanceof JMSException ? JmsUtils.buildExceptionMessage((JMSException) ex) : ex.getMessage());
if (logger.isDebugEnabled()) {
logger.error(msg, ex);
}
else {
logger.error(msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment