public final class LoggerTools
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.logging.Logger |
getLogger(java.lang.Class<?> cls)
Returns the appropriate logger for the given class.
|
static java.util.logging.Logger |
getLogger(java.lang.Object object)
Returns the appropriate logger for the given object.
|
static java.lang.String |
getLoggerName(java.lang.Class<?> cls)
Gets the name of the designated class for retrieving an appropriate logger.
|
static void |
logUnhandledException(java.lang.Throwable exception)
Logs the given otherwise unhandled exception.
|
static void |
logVirtualMachineErrorSafely(java.lang.VirtualMachineError vme,
java.lang.String backupMsg)
Logs the designated virtual machine error safely that is the error is
logged as unhandled exception but problems occurring when logging are
handled and swallowed if appropriate.
|
public static java.lang.String getLoggerName(java.lang.Class<?> cls)
cls - The name of the class for which to get a logger name.public static java.util.logging.Logger getLogger(java.lang.Class<?> cls)
getLoggerName(Class) is used to determine the name of the logger.cls - the class for which to get the appropriate loggerpublic static java.util.logging.Logger getLogger(java.lang.Object object)
LoggerTools.getLogger(object.getClass()).object - the object for which to get the appropriate loggerpublic static void logUnhandledException(java.lang.Throwable exception)
org.eclipse.ui.application.WorkbenchAdvisor#eventLoopException(Throwable)
of Eclipse RCP applicationsexception - the unhandled exception (Throwable) to be loggedpublic static void logVirtualMachineErrorSafely(java.lang.VirtualMachineError vme,
java.lang.String backupMsg)
RuntimeException will be printed to
System.err, while a VirtualMachineError will
print the designated string to System.err. No complex logic
should take place in case of a second VirtualMachineError.
However, if this leads to another RuntimeException or
VirtualMachineError, this will be swallowed to prevent the
calling thread from dying.vme - A virtual machine error to be safely logged, that is the calling
thread must survive under all circumstances.backupMsg - The message to be used in case a second
VirtualMachineError occurs while logging the
designated error.