I am currently running distcp using org.apache.hadoop.util.ToolRunner.run and the output is being written to the console.
DistCpOptions opts = getDistCpOptions(srcPath, dstPath);
private DistCpOptions getDistCpOptions(Path srcPath, Path dstPath) {
return new DistCpOptions.Builder(srcPath, dstPath).build();
}
DistCp distCp = new DistCp(new YarnConfiguration(), opts);
String[] params = {"-Dmapreduce.job.queuename=name1", "-Dmapreduce.job.name=name2",
"-Dmapreduce.job.tags=tag1", "-Dyarn.app.mapreduce.am.staging-dir=dir",
"-Dlog4j.configurationFile=file", "-Dyarn.root.logger=INFO,fileLogger",
"-bandwidth", "-update"};
int retVal = ToolRunner.run(new HdfsConfiguration(), distCp, params));
I would like to redirect this output to log4j without utilizing the console appender (since there are other outputs being directed to the console as well).
I have attempted to use System.setOut(myLogger) before invoking ToolRunner.run, but unfortunately it did not work.
I have not found anything in the YARN documentation regarding this issue.
Do you have any suggestions or ideas on how I can achieve this redirection? Thank you.
Dmitriy Vasilenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.