logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Seetha Rama Krishna <ram_ku...@yahoo.co.in>
Subject log4j implementation for web module
Date Fri, 24 Nov 2006 07:15:44 GMT
Hi folks,
         I am very new log4j and i want to implement log4j in my module. I had gone through
material in net. 
          In my module i am having 5 to 6 servlets. For writting log4j code in web application,
we have to provide the properties file like this.


              And in each servlet init() method, we have to write the code like

String props = config.getInitParameter("props");
            if(props == null || props.length() == 0 ||
                    !(new File(props)).isFile()){

                    "ERROR: Cannot read the configuration file. " +
                    "Please check the path of the config init param in web.xml");
                    throw new ServletException();
           log = Logger.getLogger(BackupServlet.class);

 I have few questions here,
1. how can i to write some genralized method, so that it can be used in any servlet class.

           i.e i dont want to write  "log = Logger.getLogger(BackupServlet.class);"
for each servlet.

  2.I am having so many classes in my module, for each class i cant write        Logger.getLogger(xxxx.class)
                      Does any body knows please help me out.



  Thanks & Regards,

 Find out what India is talking about on  - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message