Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getServletContext().log

 
mike zhang
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when use "getServletContext().log(msg)", how to specify the log file name and location ? can someone give me an example ?
Thanks,
Mike
 
Clark Bruce
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
log() writes the given message to a servlet log, prepended by the calling servlet's name. The output location (the log) is server-specific, usually an event log file. You will need to search the server directories to find the file name used.
log("I'm writing a message to the log file")
// is an example
Regards,
Clark
 
Scott Ramsey
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike:
What Clark said, except for the fact that using the log() on ServletContext does not prepend the name of a servlet--only the log() on GenericServlet does that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic