How to log api request and response xmls to a file in JAVA
Find the answer to your question
Advanced Search
Published: July 07 2006, 6:21:00 PMUpdated: July 24 2022, 4:42:29 PM
1. Add these lines to your class Constructor :
String apiOutputFile="c:\\tmp\\api_output.txt";
String errorOutputFile="c:\\tmp\\api_error.txt";
try {
java.io.PrintStream output = new java.io.PrintStream(new java.io.BufferedOutputStream(new java.io.FileOutputStream(apiOutputFile)));
System.setOut(output);
java.io.PrintStream errors = new java.io.PrintStream(new java.io.BufferedOutputStream(new java.io.FileOutputStream(errorOutputFile)));
System.setErr(errors);
}catch(java.io.IOException ioe) {
//handle exception ...
}
2. Enable logging following the instructions in this KB article:
Enable logging for Java SDK
How well did this answer your question?
Answers others found helpful