Reputation: 341
when I connect to an sftp server with Camel and the password is wrong I don't get any information about this. How can I tel camel to do something (for example log) if the connect did not attempt because of wrong password. The same goes if the username is wrong. An example how my camel route is looking follows.
CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
errorHandler(loggingErrorHandler().level(LoggingLevel.DEBUG));
from("sftp://my.sftp.server.com:21111/myDir&username=user&password=secret")
.to("file:test");
});
camelContext.start();
As far as I understand the line errorHandler(loggingErrorHandler().level(LoggingLevel.DEBUG)); should be able to log everything what happen.
Any idear?
Upvotes: 2
Views: 972
Reputation: 55550
See this FAQ
It applies to FTP as well.
You would need to bridge the route consumer with the Camel error handler, to let the route errorHandler react. Its a bit chicken and egg situatuon, the error handler normally only reacts when you have an Exchange to route. But if the FTP consumer fails before creating an Exchange, then the is no Exchange to route. That is what the bridge can do.
Upvotes: 1
Reputation: 820
The error must have been suppressed somewhere; Camel FTP component logs things in TRACE level which should be including everything. Do you use slf4j? If not, you can enable it by creating a file named "log4j.properties" in your classpath.
Set the content of this file to be:
log4j.rootLogger=INFO, out
og4j.logger.org.apache.camel=DEBUG
It would make the logging level of Camel to be DEBUG. This means that you should get a lot of logs, including the login failure.
You also need to include this in your pom.xml (if using maven):
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
Upvotes: 2