How to write into the webcontainer and see those messages using public void log(String msg) and public void log(String msg ,Throwable t)?

Showing Answers 1 - 2 of 2 Answers

amit

  • Nov 17th, 2005
 

container call servlet 's life cycle init() method in which we can define log() method .

init() method  initialize the variables and method at run time.

  Was this answer useful?  Yes

ajay kumar

  • May 16th, 2007
 

You can use log4j

here s a sample code

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;


public class MyClasss extends HttpServlet {
        private static final Logger ActionLOG = Logger.getLogger(MyClass.class);
        protected void service(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException,java.io.IOException{
                ActionLOG.info("nnn******data is updating to application context******");
...........................................................


  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions