|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.oclc.da.gdfr.registryprototype.logging.Logger
public class Logger
This class isolates the Digital Archive code from the logging facility by hiding all configuration code related to that external facility and by providing utility methods for most used exception reporting cases. The caller code is required to include information about the class reporting this error, the method is which the error was caught, possibly a tagged location inside the method (to eliminate any ambiguity), and the exception object itself from which the class type and its internal message is extracted and logged.
| Field Summary | |
|---|---|
static java.math.BigInteger |
ERROR
|
static java.math.BigInteger |
WARN
|
| Constructor Summary | |
|---|---|
protected |
Logger()
Private constructor |
| Method Summary | |
|---|---|
void |
log(int code,
java.math.BigInteger type,
java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
java.lang.Throwable ex)
Utility method to log an system exception. |
void |
log(int code,
java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
java.lang.Throwable ex)
Utility method that simplifies error reporting for known classes such as IfsException and RemoteException. |
void |
log(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
RegistryException ex)
Utility method that simplifies error reporting for RegistryException s especially those that have multiple
exception messages. |
void |
log(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
RegistrySystemException ex)
Utility method that simplifies error reporting for RegistrySystemException s especially those that have multiple
exception messages. |
static Logger |
newInstance()
Create a new instance of the Logger |
java.lang.Throwable |
resolveException(java.lang.Throwable ex)
Utility method that simplifies error reporting for regularly used exception classes such as IfsException and
RemoteException.If (ex instanceof IfsException): This method will recursively go through all the nested exceptions ignoring all IFS-30002
errors until a different IFS error code is found or a different exception
type is found. |
void |
trace(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation)
Utility method to log a trace any message. |
void |
trace(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
int code,
java.lang.String[] args)
Utility method to log a trace message. |
void |
trace(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
java.lang.String[] messageParts)
Utility method to log a trace any message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.math.BigInteger WARN
public static final java.math.BigInteger ERROR
| Constructor Detail |
|---|
protected Logger()
| Method Detail |
|---|
public static Logger newInstance()
Logger
public void log(int code,
java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
java.lang.Throwable ex)
IfsException and RemoteException. The
execution of this method is equivalent to calling the log
method with a Throwable argument and an
Logger.ERROR error level, using the return from
resolveException().
code - The error id of this error already defined in
DAExceptionCodes. It should be the error code
in the corresponding DAException that is thrown right after
this logging method completes.reporter - The object reporting this error - required.reporterMethod - The method name where this error was caught - required.reporterLocation - A location tag in the method where this error was caught -
optional.ex - The Throwable to be reported.
public void log(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
RegistryException ex)
RegistryException s especially those that have multiple
exception messages. A level of Logger.WARN is used.
reporter - The object reporting this error - required.reporterMethod - The method name where this error was caught - required.reporterLocation - A location tag in the method where this error was caught -
optional.ex - The DAException to be reported.
public void log(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
RegistrySystemException ex)
RegistrySystemException s especially those that have multiple
exception messages. A level of Logger.ERROR is used.
reporter - The object reporting this error - required.reporterMethod - The method name where this error was caught - required.reporterLocation - A location tag in the method where this error was caught -
optional.ex - The DASystemException to be reported.
public void log(int code,
java.math.BigInteger type,
java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
java.lang.Throwable ex)
Throwable argument is NOT checked for wrapped
exceptions, as is the case with IfsException and
RemoteException. This throwable is logged as such. If you
want to log the core of the problem and not the wrapper exception, use
the method above.
code - The error id of this error already defined in
DAExceptionCodes. It should be the error code
in the corresponding DAException that is thrown right after
this logging method completes.type - One of ExceptionLogger.WARN or
ExceptionLogger.ERROR. The first translates to
an iSoft Incident of type
Incident.WARNING, the latter to one of type
Incident.CRITICAL. If the code is not one of
WARN or ERROR, the method
assigns ERROR as default.reporter - The object reporting this error - required.reporterMethod - The method name where this error was caught - required.reporterLocation - A location tag in the method where this error was caught -
optional.ex - The Throwable to be reported.
public void trace(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
int code,
java.lang.String[] args)
TRACE and the type is translated to
Incident.INFO.
reporter - The object reporting this error - required.reporterMethod - The method name where this error was caught - required.reporterLocation - A location tag in the method where this error was caught -
optional.code - A message string that conforms to the pattern substitution
rules documented in DAExceptionCodes class.args - The arguments to be substituted in the pattern.
public void trace(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation,
java.lang.String[] messageParts)
TRACE and the type is translated to
Incident.INFO.
reporter - The object reporting this error - required.reporterMethod - The method name where this error was caught - required.reporterLocation - A location tag in the method where this error was caught -
optional.messageParts - The parts of the message to be traced - optional.
public void trace(java.lang.Object reporter,
java.lang.String reporterMethod,
java.lang.String reporterLocation)
TRACE and the type is translated to
Incident.INFO.
reporter - The object reporting this error - required.reporterMethod - The method name where this error was caught - required.reporterLocation - A location tag in the method where this error was caught -
optional.public java.lang.Throwable resolveException(java.lang.Throwable ex)
IfsException and
RemoteException.IFS-30002
errors until a different IFS error code is found or a different exception
type is found. If the argument has no nested exceptions, the method
returns the exception passed in the argument.
ex - The Throwable to be searched.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||