Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enthuware Web Container Model Question

 
Isha Garg
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the code for doGet method of a servlet.



Which of the given LOCs can be inserted at //1 to log the message as well as the exception's stack trace?
1. req.log(e, "Unknown User");
2.req.log(e, "Unknown User");
3.this.getServletContext().log("Unknown User",e);
4.this.getServletContext().log(e, "Unknown User");
5.The stack trace of the exception cannot be logged using log(...) methods.

Correct answer is 3.
But I say it should also be 4.
As, in ServletContext we have message log(Exception e,String message)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's deprecated. You shouldn't use it. The API clearly states that you should "use log(String message, Throwable throwable) instead.".
 
Isha Garg
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.. Thanks for your reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic