2

A very simple question (pardon) - if a servlet throws ServletException and it runs in Tomcat - where can I inspect the exception details? Tried to look under logs but nothing is there. I probably miss something very obvious. I do not use (and at this stage don't plan to use) any log library (such as log4j), just throwing an exception and trying to see it if possible.

Appreciate!

BreakPhreak
  • 10,940
  • 26
  • 72
  • 108

1 Answers1

2

Depends. They're by default logged to Tomcat/logs/[hostname].[timestamp].log. However, if you run Tomcat from inside an IDE like Eclipse, then it will take over the logging and it'll end up in the IDE console without being written to log file.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • yes, I've installed Tomcat separately, but I am definitely launching in from Eclipse. Then, I use Chrome (not the Eclipse built-in browser) to track all the HTTP requests. I can't see anything appropriate on Eclipse console though, only bytecode deployment and start/stop-related messages and timings though... – BreakPhreak May 07 '11 at 17:41
  • Then no exception was been thrown. What exactly is the problem you're trying to solve? A connection timeout? A blank page? A 404 resource not found? Etc. – BalusC May 07 '11 at 17:46
  • I am throwing ServletException regarding the missing parameter and trying to track the info from log files. In the very near future I'll throw more fatal exceptions (not too much, though) and also plan to insert "regular" log messages - also looking for the right way to print them to the log file. – BreakPhreak May 07 '11 at 17:52
  • Hello! Sorry, you were kinda right: when printing like config.getServletContext().log(message); the message appears in the eclipse console. Also when any kind of exception is being thrown from the servlet code. Thanks again! – BreakPhreak May 07 '11 at 18:42