the getRealPath() method provided by ServletContext will convert a website relative path into a real location on disk. It will most likely help you in this case.
ServletContext application = getServletConfig().getServletContext();
String currentContextRoot = application.getRealPath("/");
String logFile = application.getRealPath("/log.txt");
From this string you can create a File object, and a FileWriter for it.