FileDocCategorySizeDatePackage
ErrorManager.javaAPI DocJava SE 5 API2436Fri Aug 26 14:57:26 BST 2005java.util.logging

ErrorManager

public class ErrorManager extends Object
ErrorManager objects can be attached to Handlers to process any error that occur on a Handler during Logging.

When processing logging output, if a Handler encounters problems then rather than throwing an Exception back to the issuer of the logging call (who is unlikely to be interested) the Handler should call its associated ErrorManager.

Fields Summary
private boolean
reported
public static final int
GENERIC_FAILURE
GENERIC_FAILURE is used for failure that don't fit into one of the other categories.
public static final int
WRITE_FAILURE
WRITE_FAILURE is used when a write to an output stream fails.
public static final int
FLUSH_FAILURE
FLUSH_FAILURE is used when a flush to an output stream fails.
public static final int
CLOSE_FAILURE
CLOSE_FAILURE is used when a close of an output stream fails.
public static final int
OPEN_FAILURE
OPEN_FAILURE is used when an open of an output stream fails.
public static final int
FORMAT_FAILURE
FORMAT_FAILURE is used when formatting fails for any reason.
Constructors Summary
Methods Summary
public synchronized voiderror(java.lang.String msg, java.lang.Exception ex, int code)
The error method is called when a Handler failure occurs.

This method may be overriden in subclasses. The default behavior in this base class is that the first call is reported to System.err, and subsequent calls are ignored.

param
msg a descriptive string (may be null)
param
ex an exception (may be null)
param
code an error code defined in ErrorManager


                                                                                 
             
	if (reported) {
	    // We only report the first error, to avoid clogging
	    // the screen.
	    return;
	}	
	reported = true;
	String text = "java.util.logging.ErrorManager: " + code;
	if (msg != null) {
	    text = text + ": " + msg;
	}
	System.err.println(text);
	if (ex != null) {
	    ex.printStackTrace();
	}