String logFile = "/var/log/tomcat6/"+arg0.getServletContext().getContextPath().substring(1).replace("/", "_")+".log";
fileHandler = new FileHandler(logFile, 0, 1, true);
fileHandler.setFormatter(new LogFormatter());
l.addHandler(fileHandler);
} catch (SecurityException e) {
e.printStackTrace();