javaapache-camelcamel-ftp

Stop Apache Camel from logging full path of file being moved


I'm using Apache Camel for moving a file from one place to another. While moving, it logs the full file path. Is there a way to hide it?

Here's the relevant code snippet:

from(source).routeId(ROUTE_ID)
            .marshal()
            .process(processor)
            .setHeader(Exchange.FILE_NAME, constant("file.txt"))
            .to(destination)
            .end();

And here's the log (please check at the end of the log):

2020-04-04 03:42:49,013 INFO task-1 org.apache.camel.spring.SpringCamelContext doStartOrResumeRouteConsumers - Route: MyRoute started and consuming from: file:///Users/user/Desktop/?include=file.csv

Also I have another small question:
Is there a difference between using ?fileName="desiredFileName.txt" option in the filePath & using setHeader(Exchange.FILE_NAME, constant("desiredFileName.txt")) ? I doubt that adding fileName parameter is renaming file on the server, and not doing it locally, and then uploading it.


Solution

  • You cannot disable that log line without changing logging level or by creating your own version of camel core. That logging is defined on this line. in AbstractCamelContext. But good thing is that it happens only once when the route ist started.

    There is no difference in using fileName in option or the Exchange.FILE_NAME header. But if fileName option is set, it will be used over the FILE_NAME header.