Source:
<code>public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) { if (StringUtils.isBlank(accountingXmlDocumentBackupLink.getCredentialGroupCode())) { LOG.error("createAttachmentFromBackupLink, the Credential Group Code is blank"); throw new ValidationException("Unable to download attachment with blank Credential Group Code: " + accountingXmlDocumentBackupLink.getLinkUrl()); } try { byte[] formFile = downloadByteArray(accountingXmlDocumentBackupLink); if (formFile.length > 0) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(uploadFileName); int fileSize = (int) formFile.length; String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream inputStream = new ByteArrayInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, inputStream, attachmentType); return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); throw new ValidationException("The form file is NULL: " + accountingXmlDocumentBackupLink.getLinkUrl()); } } catch (IOException e) { <START> LOG.error("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); <END> throw new ValidationException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); } }</code><technical_language>This logging statement start name of enclosing method, for consistency setting other log messages. Also, I this logging call pass in exception argument, view stack trace in logs</technical_language>

Target:
public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) { if (StringUtils.isBlank(accountingXmlDocumentBackupLink.getCredentialGroupCode())) { LOG.error("createAttachmentFromBackupLink, the Credential Group Code is blank"); throw new ValidationException("Unable to download attachment with blank Credential Group Code: " + accountingXmlDocumentBackupLink.getLinkUrl()); } try { byte[] formFile = downloadByteArray(accountingXmlDocumentBackupLink); if (formFile.length > 0) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(uploadFileName); int fileSize = (int) formFile.length; String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream inputStream = new ByteArrayInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, inputStream, attachmentType); return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); throw new ValidationException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); } } catch (IOException e) { LOG.error("createAttachmentFromBackupLink, Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl(), e); throw new ValidationException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); } }