Spring integration 记录SFTP上的实际文件/目录;“没有此类文件”;失败

Spring integration 记录SFTP上的实际文件/目录;“没有此类文件”;失败,spring-integration,spring-integration-sftp,Spring Integration,Spring Integration Sftp,我们大量使用Spring集成,而且效果非常好。但是,我不确定如何让Jsch/Spring集成记录有问题的实际文件,例如,当我在sftp服务器上不存在的目录上尝试创建列表时引发错误。我有如下例外情况 有没有办法诱使Spring Integration或Jsch在文件上打印“没有这样的文件”的信息?当我查看Jsch代码时,似乎没有针对该特定问题的任何日志记录,但我可能遗漏了一些内容,即使它没有什么内容,可能捕获此异常的Spring代码有一些可以记录的上下文 事实上,我们要么在这样的实例中附加一个调试

我们大量使用Spring集成,而且效果非常好。但是,我不确定如何让Jsch/Spring集成记录有问题的实际文件,例如,当我在sftp服务器上不存在的目录上尝试创建列表时引发错误。我有如下例外情况

有没有办法诱使Spring Integration或Jsch在文件上打印“没有这样的文件”的信息?当我查看Jsch代码时,似乎没有针对该特定问题的任何日志记录,但我可能遗漏了一些内容,即使它没有什么内容,可能捕获此异常的Spring代码有一些可以记录的上下文

事实上,我们要么在这样的实例中附加一个调试器,要么尝试对可能需要设置的目录进行有根据的猜测

Caused by: org.springframework.messaging.MessagingException: Failed to execute on session; nested exception is org.springframework.core.NestedIOException: Failed to list files; nested exception is 2: No such file
    at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:444)
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:235)
    ... 13 common frames omitted
Caused by: org.springframework.core.NestedIOException: Failed to list files; nested exception is 2: No such file
    at org.springframework.integration.sftp.session.SftpSession.list(SftpSession.java:104)
    at org.springframework.integration.sftp.session.SftpSession.list(SftpSession.java:50)
    at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.list(CachingSessionFactory.java:218)
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer$1.doInSession(AbstractInboundFileSynchronizer.java:239)
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer$1.doInSession(AbstractInboundFileSynchronizer.java:235)
    at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:435)
    ... 14 common frames omitted
Caused by: com.jcraft.jsch.SftpException: No such file
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)

我打开以将目录添加到异常中。

为什么不在消息头中设置文件名,并将其记录到异常处理程序中?这主意不错,但我不确定我在所有情况下都能看到这样做的明确方法。例如,我们使用int-sftp:inbound channel adapter,例如,它在看到一个文件时会传入一个通道。有没有办法将远程目录值添加到头中?