ErrorManager
Stay organized with collections
Save and categorize content based on your preferences.
ErrorManager objects can be attached to Handlers to process
any error that occurs 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.
Constant Summary
int |
CLOSE_FAILURE |
CLOSE_FAILURE is used when a close of an output stream fails. |
int |
FLUSH_FAILURE |
FLUSH_FAILURE is used when a flush to an output stream fails. |
int |
FORMAT_FAILURE |
FORMAT_FAILURE is used when formatting fails for any reason. |
int |
GENERIC_FAILURE |
GENERIC_FAILURE is used for failure that don't fit
into one of the other categories. |
int |
OPEN_FAILURE |
OPEN_FAILURE is used when an open of an output stream fails. |
int |
WRITE_FAILURE |
WRITE_FAILURE is used when a write to an output stream fails. |
Public Constructor Summary
Inherited Method Summary
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait(long timeout, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long timeout)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
Constants
public
static
final
int
CLOSE_FAILURE
CLOSE_FAILURE is used when a close of an output stream fails.
Constant Value:
3
public
static
final
int
FLUSH_FAILURE
FLUSH_FAILURE is used when a flush to an output stream fails.
Constant Value:
2
FORMAT_FAILURE is used when formatting fails for any reason.
Constant Value:
5
public
static
final
int
GENERIC_FAILURE
GENERIC_FAILURE is used for failure that don't fit
into one of the other categories.
Constant Value:
0
public
static
final
int
OPEN_FAILURE
OPEN_FAILURE is used when an open of an output stream fails.
Constant Value:
4
public
static
final
int
WRITE_FAILURE
WRITE_FAILURE is used when a write to an output stream fails.
Constant Value:
1
Public Methods
public
synchronized
void
error
(String msg, Exception ex, int code)
The error method is called when a Handler failure occurs.
This method may be overridden in subclasses. The default
behavior in this base class is that the first call is
reported to System.err, and subsequent calls are ignored.
Parameters
msg |
a descriptive string (may be null) |
ex |
an exception (may be null) |
code |
an error code defined in ErrorManager
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eErrorManager\u003c/code\u003e objects are attached to Handlers to process errors during logging, preventing exceptions from being thrown back to the logging issuer.\u003c/p\u003e\n"],["\u003cp\u003eWhen a Handler encounters an issue, it calls its associated \u003ccode\u003eErrorManager\u003c/code\u003e's \u003ccode\u003eerror\u003c/code\u003e method instead of throwing an exception.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eErrorManager\u003c/code\u003e provides predefined error codes like \u003ccode\u003eCLOSE_FAILURE\u003c/code\u003e, \u003ccode\u003eFLUSH_FAILURE\u003c/code\u003e, \u003ccode\u003eFORMAT_FAILURE\u003c/code\u003e, \u003ccode\u003eGENERIC_FAILURE\u003c/code\u003e, \u003ccode\u003eOPEN_FAILURE\u003c/code\u003e, and \u003ccode\u003eWRITE_FAILURE\u003c/code\u003e to categorize logging failures.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eerror\u003c/code\u003e method, which can be overridden, takes a descriptive message, an exception, and an error code as parameters to handle the error appropriately.\u003c/p\u003e\n"],["\u003cp\u003eBy default, \u003ccode\u003eErrorManager\u003c/code\u003e reports the first error to \u003ccode\u003eSystem.err\u003c/code\u003e and ignores subsequent errors.\u003c/p\u003e\n"]]],["`ErrorManager` objects process errors encountered by `Handlers` during logging. Instead of throwing exceptions, `Handlers` use `ErrorManager`'s `error` method to report issues. This method takes a message, exception, and error code. Predefined error codes include `CLOSE_FAILURE`, `FLUSH_FAILURE`, `FORMAT_FAILURE`, `GENERIC_FAILURE`, `OPEN_FAILURE`, and `WRITE_FAILURE`. The default `error` behavior reports the first call to `System.err` and ignores subsequent calls.\n"],null,["# ErrorManager\n\npublic class **ErrorManager** extends [Object](../../../../reference/java/lang/Object.html) \nErrorManager objects can be attached to Handlers to process\nany error that occurs on a Handler during Logging.\n\n\nWhen processing logging output, if a Handler encounters problems\nthen rather than throwing an Exception back to the issuer of\nthe logging call (who is unlikely to be interested) the Handler\nshould call its associated ErrorManager. \n\n### Constant Summary\n\n|-----|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| int | [CLOSE_FAILURE](../../../../reference/java/util/logging/ErrorManager.html#CLOSE_FAILURE) | CLOSE_FAILURE is used when a close of an output stream fails. |\n| int | [FLUSH_FAILURE](../../../../reference/java/util/logging/ErrorManager.html#FLUSH_FAILURE) | FLUSH_FAILURE is used when a flush to an output stream fails. |\n| int | [FORMAT_FAILURE](../../../../reference/java/util/logging/ErrorManager.html#FORMAT_FAILURE) | FORMAT_FAILURE is used when formatting fails for any reason. |\n| int | [GENERIC_FAILURE](../../../../reference/java/util/logging/ErrorManager.html#GENERIC_FAILURE) | GENERIC_FAILURE is used for failure that don't fit into one of the other categories. |\n| int | [OPEN_FAILURE](../../../../reference/java/util/logging/ErrorManager.html#OPEN_FAILURE) | OPEN_FAILURE is used when an open of an output stream fails. |\n| int | [WRITE_FAILURE](../../../../reference/java/util/logging/ErrorManager.html#WRITE_FAILURE) | WRITE_FAILURE is used when a write to an output stream fails. |\n\n### Public Constructor Summary\n\n|---|--------------------------------------------------------------------------------------------|\n| | [ErrorManager](../../../../reference/java/util/logging/ErrorManager.html#ErrorManager())() |\n\n### Public Method Summary\n\n|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| synchronized void | [error](../../../../reference/java/util/logging/ErrorManager.html#error(java.lang.String,%20java.lang.Exception,%20int))([String](../../../../reference/java/lang/String.html) msg, [Exception](../../../../reference/java/lang/Exception.html) ex, int code) The error method is called when a Handler failure occurs. |\n\n### Inherited Method Summary\n\nFrom class [java.lang.Object](../../../../reference/java/lang/Object.html) \n\n|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Object](../../../../reference/java/lang/Object.html) | [clone](../../../../reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |\n| boolean | [equals](../../../../reference/java/lang/Object.html#equals(java.lang.Object))([Object](../../../../reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |\n| void | [finalize](../../../../reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |\n| final [Class](../../../../reference/java/lang/Class.html)\\\u003c?\\\u003e | [getClass](../../../../reference/java/lang/Object.html#getClass())() Returns the unique instance of [Class](../../../../reference/java/lang/Class.html) that represents this object's class. |\n| int | [hashCode](../../../../reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |\n| final void | [notify](../../../../reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| final void | [notifyAll](../../../../reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| [String](../../../../reference/java/lang/String.html) | [toString](../../../../reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |\n\nConstants\n---------\n\n#### public static final int\n**CLOSE_FAILURE**\n\nCLOSE_FAILURE is used when a close of an output stream fails. \nConstant Value: 3 \n\n#### public static final int\n**FLUSH_FAILURE**\n\nFLUSH_FAILURE is used when a flush to an output stream fails. \nConstant Value: 2 \n\n#### public static final int\n**FORMAT_FAILURE**\n\nFORMAT_FAILURE is used when formatting fails for any reason. \nConstant Value: 5 \n\n#### public static final int\n**GENERIC_FAILURE**\n\nGENERIC_FAILURE is used for failure that don't fit\ninto one of the other categories. \nConstant Value: 0 \n\n#### public static final int\n**OPEN_FAILURE**\n\nOPEN_FAILURE is used when an open of an output stream fails. \nConstant Value: 4 \n\n#### public static final int\n**WRITE_FAILURE**\n\nWRITE_FAILURE is used when a write to an output stream fails. \nConstant Value: 1\n\nPublic Constructors\n-------------------\n\n#### public\n**ErrorManager**\n()\n\n\u003cbr /\u003e\n\nPublic Methods\n--------------\n\n#### public synchronized void\n**error**\n([String](../../../../reference/java/lang/String.html) msg, [Exception](../../../../reference/java/lang/Exception.html) ex, int code)\n\nThe error method is called when a Handler failure occurs.\n\n\nThis method may be overridden in subclasses. The default\nbehavior in this base class is that the first call is\nreported to System.err, and subsequent calls are ignored. \n\n##### Parameters\n\n| msg | a descriptive string (may be null) |\n| ex | an exception (may be null) |\n| code | an error code defined in ErrorManager |\n|------|---------------------------------------|"]]