KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sellwin > utils > LogWrite


1 package sellwin.utils;
2
3 import java.util.*;
4 import java.io.*;
5 import java.text.*;
6 import java.awt.*;
7
8 // SellWin http://sourceforge.net/projects/sellwincrm
9
//Contact support@open-app.com for commercial help with SellWin
10
//This software is provided "AS IS", without a warranty of any kind.
11

12 /**
13  */

14 public class LogWrite {
15
16     public static void write(Exception JavaDoc e) {
17         StackTraceElement JavaDoc[] tracelines = e.getStackTrace();
18         for (int i=0;i<tracelines.length;i++) {
19             write(tracelines[i].toString());
20         }
21
22     }
23
24     static PrintWriter pw = null;
25     public static void init() {
26         try {
27
28         pw = new PrintWriter(new FileOutputStream("sellwin.log"));
29
30         } catch (Exception JavaDoc e) {
31             e.printStackTrace();
32         }
33     }
34
35     public static void write(String JavaDoc str) {
36         System.out.println(str);
37         //pw.println(str);
38
//pw.flush();
39
}
40
41     public static void close() {
42         pw.close();
43     }
44 }
45
Popular Tags