https://issues.apache.org/jira/browse/AMQ-4819

Slightly modified version of the patch since it was not against latest
code.  Trimmed down the changes by breaking out the logging checks into
a separate method.