I'm doing some custom logging to a text file to make things easier and cheaper than to 
logging to a database.  The servlet would get the header information, session Id and 
so on and attemps to log it to a file.  The problem I have is I don't know how to 
insert it to a file instead of overwritting it.  Instead of having multiple entries, 
it will open the file and overwrite what's on it resulting in a file having only one 
log.

Here is my code:
try {
  String outputFileName = "F:" + File.separatorChar + "LLog.txt";
  FileWriter fout = new FileWriter(outputFileName);
  String newLine = System.getProperty("line.separator");
  String data = session.getValue("userID") + ";" + session.getId() + ";" + 
request.getRemoteAddr() + ";" + date + newLine;
  fout.write(data);
  fout.close();
 } catch(java.io.IOException e) {
  System.out.println("Cannot access LLog.txt");
 }

How would I modify it so it will insert the log at the end of the file and not 
overwritting previous entries?

Thanks!!!!

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to