devxlogo

April 1, 2009

Destroy a Java Logger using the contextDestroyed Method

public void contextDestroyed(ServletContextEvent e) { //get the servlet context ServletContext servletContext = e.getServletContext(); //get the real path String root = servletContext.getRealPath(“/”); //get all handlers Handler[] handlers = logger.getHandlers(); //remove all

Be Careful of Negative Array Indices

While porting a 32-bit application to a 64-bit version, I discovered an interesting effect. The original code used negative array indexes frequently, which worked fine on a 32-bit machine, but