1 7 8 9 package java.util.logging; 10 11 20 21 public class ErrorManager { 22 private boolean reported = false; 23 24 27 28 32 public final static int GENERIC_FAILURE = 0; 33 36 public final static int WRITE_FAILURE = 1; 37 40 public final static int FLUSH_FAILURE = 2; 41 44 public final static int CLOSE_FAILURE = 3; 45 48 public final static int OPEN_FAILURE = 4; 49 52 public final static int FORMAT_FAILURE = 5; 53 54 65 public synchronized void error(String msg, Exception ex, int code) { 66 if (reported) { 67 return; 70 } 71 reported = true; 72 String text = "java.util.logging.ErrorManager: " + code; 73 if (msg != null) { 74 text = text + ": " + msg; 75 } 76 System.err.println(text); 77 if (ex != null) { 78 ex.printStackTrace(); 79 } 80 } 81 } 82 | Popular Tags |