//Create a file object
File file = new File("c:\\temp\\log.txt");

//Create a FileWriter for easy output
try {
  FileWriter fw = new FileWriter(File);
} catch(Exception e) {
  System.out.println("Problem opening log file");
  System.out.println(e);
}

//Any time you have an error message, do this
try {
  fw.write("This is an error message!");
} catch(Exception e) {
  System.out.println("Problem writing to log file");
  System.out.println(e);
}


If you have trouble with security messages, you need to either sign the app
with a Verisign or Thawte ID or modify your java.policy to allow writing of
the file(s). Add this line to java.policy for the program above:

permission java.io.FilePermission "c:\\temp\\log.txt", "write";

Good luck,
Brian


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Harkishin Nachnani
Sent: Friday, February 02, 2001 1:20 PM
To: '[EMAIL PROTECTED]'
Subject: Logging in Java


Hi all:
I have created a front-end user interface in Swing which communicates with
the middleware server.
Till now I was using "System.out.println()" statement for debugging but
since we have to ship the product, I have to remove all the print statements
and instead log all the messages in a log file.
Can u guys give me a headstart as to what I should do ??? maybe some link or
piece of code which will help me get started.

Cheers
Harry
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing


_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to