[Webinar] Streamline your web hosting managementRegister Today


JavaWebServer Log

Posted on 2000-02-02
Medium Priority
Last Modified: 2010-04-01
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.

Question by:dipak_kr_ghosh
  • 3

Expert Comment

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

For example

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

you should generally override this function though.

Accepted Solution

rainmal earned 200 total points
ID: 2484716
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.

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
      PrintStream f = new PrintStream(new               FileOutputStream(File.separator + "log.log"),false);
catch(Exception e)
hope this helps .

Author Comment

ID: 2492414
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.

Expert Comment

ID: 2492996
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.

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month7 days, 22 hours left to enroll

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question