package utiliServlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import m05bClasses.StdOutErrLog;

import org.apache.log4j.xml.DOMConfigurator;

public class ApplicationServletContextListener implements
		ServletContextListener {

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
//		ServletContext ctx = arg0.getServletContext();

//		String prefix = ctx.getRealPath("/");
		String file = System.getProperty("file.separator");
//				
//				+ "log4j.properties";

		//if (file != null) //{
			  DOMConfigurator.configure(file+"config"+file+"wl11_intra_apps_dpto"+file+"m05b"+file+"m05bLog4j.xml");	
			//  StdOutErrLog.tieSystemOutAndErrToLog();
//			  File errDumpFile = new File(file+"datos"+file+"m05b"+file+"log"+file+"stdout.txt");
//			  FileOutputStream fos;
//			try {
//				fos = new FileOutputStream(errDumpFile);
//				 PrintStream ps = new PrintStream(fos);
//				 System.setErr(ps);
//			} catch (FileNotFoundException e) {
//				// TODO Auto-generated catch block
//				miLog.addTraza(e);
//			}
			 
			 
	//		PropertyConfigurator.configure("\\config\\m05b\\log4j.properties");
//			System.out.println("Log4J Logging started for application: "
//					+ prefix + file); 
//		} else {
//			System.out
//					.println("Log4J Is not configured for application Application: "
//							+ prefix + file);
//		}

	}

}