JavaWebServer Log

I am using JavaWebServer2.0 for deploying my servlets. For testing the code I have put System.out.println() and System.err.println() but the messages are not coming in the log files in the sub-directories of the logs folder of JavaWebServer2.0. Can anyone tell me as to where I should look for the messages or what should be the strategy for debugging.

regards.
dipak_kr_ghoshAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rainmalCommented:
Don't use System.out to write to the server log
just call log() with your message.

For example
log("error");

This will log the message into the event log of the web server

you should generally override this function though.
0
rainmalCommented:
you can also implement your custom log file method by overriding the log in your Servlet by changing the line in that method above and implementing the method with same return type & signature.

i.e
say IsrServlet.java is your file

class IsrServlet extends ......
{
   public void log(String msg)
  {
      getServletContext().log(getClass().getName() + ":CHANGED LOG "+        msg);
 }
 
}

or force the log into your own file using
try
{
      PrintStream f = new PrintStream(new               FileOutputStream(File.separator + "log.log"),false);
      System.setOut(f);
      System.setErr(f);
}
catch(Exception e)
{}
 
hope this helps .
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dipak_kr_ghoshAuthor Commented:
Hi rainmal
 I tried out your first suggestion, but it did not work. Any way now I am writing all the necessary output to my own file than depending on the server for that.
0
rainmalCommented:
well make sure you are looking for the log in your server event log .

For thr java web server , it logs in the event log which you read thru the server admin util...I'm pretty sure of that cause I've personally used it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.