I am calling a web service using the following code
public static ServResponse enGenderAndSentiment(String url, Tweet t) {
HttpClient httpClient = new DefaultHttpClient();
String responseBody = "";
ServResponse holder = null;
try {
# calling a web service here
} catch (Exception ex) {
logger.debug("Exception while calling api for : " + t.getId());
logger.debug(ex);
} finally {
httpClient.getConnectionManager().shutdown();
}
return holder;
}
An exception is thrown while executing the previous code and when I check the log file, I found the message Exception while calling ... but I the exception itself is not logged.
What could be the problem here? why the second logging statement is not printing anything in the log file?
Use logger.error(ex,ex);
instead of logger.debug(ex);
to log also the stacktrace (with optional cause exceptions)...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.