I have some doubts about the anwser of this question, beacuse I know that ServletContext(String, Throwable) is the best option but it is NOT the only one.
The ServletContext API (Jave EE 6) also indicates a Deprecated method:
Code: Select all
void log(Exeption exception,
java.lang.String msg)
Deprecated. As of Java Servlet API 2.1, use log(String message, Throwable throwable) instead.
This method was originally defined to write an exception's stack trace and an explanatory error message to the servlet log file.