String realPath = getServletContext().getRealPath("/");
String fileSep = System.getProperty("file.separator" );
if (realPath != null && (! realPath.endsWith(fileSep)))
realPath = realPath + fileSep;
System.out.println(realPath);
//load the configuration for this application's loggers using the servletLog.properties file
PropertyConfigurator.configure(realPath + "WEB-INF/classes/servletLog.properties");
//create the logger for this servlet class
//it will use the configuration for the logger com.jspservletcookbook.LoggerServlet
//or inherit from the logger com.jspservletcookbook if one exists, and so on
log = Logger.getLogger(LoggerServlet.class);
log.info("LoggerServlet started.");