Hey, I've made a very simple java servlet in Eclipse and I wrote my own logging class which opens a file and writes to it.
This logging class works fine, however when I tried to use it inside the doGet method of my servlet it wouldn't open the file and write to it but my servlet worked fine. Any ideas what's going on? The file is not even created either.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub // TODO Auto-generated method stub Enumeration en = request.getHeaderNames(); Object obj = null; String temp = ""; while(en.hasMoreElements()){ obj = en.nextElement(); //gets name of header temp = obj.toString(); temp = appender(temp); response.getWriter().write(temp+request.getHeader(obj.toString())); response.getWriter().println(); } LogWriter.write("Why doesn't this stupid thing work???"); LogWriter.write("HELLO"); }
Cheers