public abstract class AbstractDiagnosable extends java.lang.Object implements Diagnosable
| Modifier and Type | Field and Description |
|---|---|
protected Diagnostic |
diagnostic
The reference of
Diagnostic class used for
recording Diagnose First Failure and debug logs. |
protected static java.util.function.Predicate<java.lang.String> |
IS_VALID_BOOLEAN_STRING |
static java.util.function.Predicate<java.lang.String> |
IS_VALID_BUFFER_SIZE |
protected static java.util.function.Predicate<java.lang.String> |
IS_VALID_LOGGER_NAME |
| Constructor and Description |
|---|
AbstractDiagnosable() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
abstractPropertyChange(PropertyChangeEvent event)
The common event handler implementation of
PropertyChangeEvent
propertyChange(PropertyChangeEvent). |
void |
begin(Metrics.ConnectionEvent event)
Begins collecting metrics for the given event.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown)
Debug API with no args.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object... args)
If Diagnose First Failure is active, creates an OracleLogRecord and passes it to the
java.util.logging.Logger configured for this Diagnosable.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg)
Debug with one arg.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2)
Debug API with two args.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Debug API with three args.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Debug API with four args.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5)
Debug API with five args.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6)
Debug API with six args.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6,
java.lang.Object arg7)
Debug API with seven args.
|
<T extends java.lang.Throwable> |
debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6,
java.lang.Object arg7,
java.lang.Object arg8)
Debug API with eight args.
|
<T extends java.lang.Throwable> |
debugp(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.util.function.Supplier<java.lang.Object[]> argsSupplier)
If Diagnose First Failure is enabled, creates an OracleLogRecord and passes it to the
java.util.logging.Logger configured for this Diagnosable.
|
void |
enableDiagnoseFirstFailureDump(boolean enableDump)
Enables or disables the automatic dump of Diagnose First Failure data on error.
|
static void |
enableGlobalDebug(boolean enabled)
Set or reset the global debug flag.
|
static void |
enableMetrics(boolean isEnabled) |
static void |
enableWriteLogsToDiagnoseFirstFailure(boolean enabled)
Set or reset the flag that enables writing debug logs to Diagnose First Failure.
|
void |
end(Metrics.ConnectionEvent event)
Ends collecting metrics for the given event.
|
protected abstract java.lang.String |
getDiagnosticLoggerName() |
protected static java.lang.String |
getSystemProperty(java.lang.String key,
java.lang.String defaultValue,
java.util.function.Predicate isValid)
Reads the given system property.
|
protected abstract TraceAttributes |
getTraceAttributes() |
static boolean |
isGlobalDebugEnabled()
Returns true if global debug logging flag is enabled.
|
boolean |
isLoggable(java.util.logging.Level level)
Check if a message of the given level would actually be logged by this logger.
|
static boolean |
isMetricsEnabled() |
boolean |
isSensitiveEnabled()
Returns
true if sensitive logging is enabled, Otherwise
returns false |
protected abstract boolean |
isSensitivePermitted() |
static boolean |
isWriteLogsToDiagnoseFirstFailureEnabled() |
void |
onClose()
Action to be performed on close of this diagnosable.
|
protected static void |
onConfigFileChange(java.lang.String loggingConfigFileName)
Reinitialize the logging properties and reread the logging configuration
from the given stream, which should be in java.util.Properties format.
|
void |
resumeLogging()
Resume Diagnose First Failure and debug logging after it is temporarily suspended by
calling suspendLogging.
|
java.lang.Object |
secure(java.lang.Object value)
Return a secure representation for the value.
|
protected abstract void |
setDebugEnabled(boolean isEnabled) |
protected abstract void |
setDiagnoseFirstFailureEnabled(boolean isEnabled) |
protected void |
setSensitiveEnabled(boolean enabled)
Before enabling sensitive logging, this method checks if sensitive logging
is permitted.
|
void |
suspendLogging()
Temporarily suspend Diagnose First Failure and debug logging.
|
<T extends java.lang.Throwable> |
trace(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object... args)
If diagnose first failure is enabled store an OracleLogRecord in the appropriate
ring buffer.
|
<T extends java.lang.Throwable> |
tracep(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.util.function.Supplier<java.lang.Object[]> argsSupplier)
If diagnose first failure is enabled store an OracleLogRecord in the appropriate
ring buffer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbeginCurrentSql, endCurrentSql, format, getDiagnosable, isDebugEnabled, isDiagnoseFirstFailureEnabled, propertyChangeprotected Diagnostic diagnostic
Diagnostic class used for
recording Diagnose First Failure and debug logs.public static final java.util.function.Predicate<java.lang.String> IS_VALID_BUFFER_SIZE
protected static final java.util.function.Predicate<java.lang.String> IS_VALID_BOOLEAN_STRING
protected static final java.util.function.Predicate<java.lang.String> IS_VALID_LOGGER_NAME
protected abstract void setDebugEnabled(boolean isEnabled)
protected abstract void setDiagnoseFirstFailureEnabled(boolean isEnabled)
protected abstract boolean isSensitivePermitted()
protected abstract java.lang.String getDiagnosticLoggerName()
protected abstract TraceAttributes getTraceAttributes()
protected void setSensitiveEnabled(boolean enabled)
IllegalStateException if sensitive logging is
not permitted.enabled - public void enableDiagnoseFirstFailureDump(boolean enableDump)
enableDump - enable or disable automatic dump of Diagnose First Failure dataprotected static java.lang.String getSystemProperty(java.lang.String key,
java.lang.String defaultValue,
java.util.function.Predicate isValid)
str - the system property namedefaultValue - the default value to be returned if property is not set.isValid - predicateprotected void abstractPropertyChange(PropertyChangeEvent event)
PropertyChangeEvent
propertyChange(PropertyChangeEvent).
The concrete classes oracle.jdbc.driver.ConnectionDiagnosable and
oracle.jdbc.diagnostics.CommonDiagnosable override
propertyChange(PropertyChangeEvent) and call this method for common event handling.event - A PropertyChangeEvent object describing the event source and the property
that has changed.public boolean isSensitiveEnabled()
Diagnosabletrue if sensitive logging is enabled, Otherwise
returns falseisSensitiveEnabled in interface Diagnosableprotected static void onConfigFileChange(java.lang.String loggingConfigFileName)
loggingConfigFileName - the name of logging properties file to read.public static void enableGlobalDebug(boolean enabled)
enabled - public static boolean isGlobalDebugEnabled()
public static void enableWriteLogsToDiagnoseFirstFailure(boolean enabled)
enabled - public static boolean isWriteLogsToDiagnoseFirstFailureEnabled()
public static void enableMetrics(boolean isEnabled)
public static boolean isMetricsEnabled()
public final <T extends java.lang.Throwable> T trace(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object... args)
trace in interface DiagnosableT - level - log levellabel - security labelclassName - the name of a class from which trace() is calledmethodName - the name of a method from which trace() is calledpublicMessage - some public messageprivateMessage - some private message (null in the 1st version)thrown - exception thrown (null for entering and returning calls, non-null for throwing calls)args - caller method's args, if is called in "entering" contextpublic final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object... args)
debug in interface DiagnosableT - level - log levellabel - security labelclassName - the name of a class from which trace() is calledmethodName - the name of a method from which trace() is calledpublicMessage - some public messageprivateMessage - some private message (null in the 1st version)thrown - exception thrown (null for entering and returning calls, non-null for throwing calls)args - caller method's args, if is called in "entering" contextpublic final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6,
java.lang.Object arg7)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T debug(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6,
java.lang.Object arg7,
java.lang.Object arg8)
Diagnosabledebug in interface DiagnosableDiagnosable.debug(Level, SecurityLabel, String, String, String, String, Throwable, Object...)public final <T extends java.lang.Throwable> T tracep(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.util.function.Supplier<java.lang.Object[]> argsSupplier)
Diagnosabletracep in interface Diagnosablelevel - log levelclassName - the name of a class from which trace() is calledmethodName - the name of a method from which trace() is calledpublicMessage - some public messageprivateMessage - some private messagethrown - exception thrown (null for entering and returning calls, non-null for throwing calls)argsSupplier - caller method's args supplier, if is called in "entering" contextpublic final <T extends java.lang.Throwable> T debugp(java.util.logging.Level level,
SecurityLabel label,
java.lang.String className,
java.lang.String methodName,
java.lang.String publicMessage,
java.lang.String privateMessage,
T thrown,
java.util.function.Supplier<java.lang.Object[]> argsSupplier)
Diagnosabledebugp in interface Diagnosablelevel - log levelclassName - the name of a class from which trace() is calledmethodName - the name of a method from which trace() is calledpublicMessage - some public messageprivateMessage - some private messagethrown - exception thrown (null for entering and returning calls, non-null for throwing calls)argsSupplier - caller method's args supplier, if is called in "entering" contextpublic java.lang.Object secure(java.lang.Object value)
secure in interface Diagnosablevalue - the value to return if sensitive mode is enabledpublic void suspendLogging()
suspendLogging in interface Diagnosablepublic void resumeLogging()
resumeLogging in interface Diagnosablepublic boolean isLoggable(java.util.logging.Level level)
DiagnosableisLoggable in interface Diagnosablepublic void onClose()
onClose in interface Diagnosablepublic void begin(Metrics.ConnectionEvent event)
begin in interface Diagnosableevent - the event namepublic void end(Metrics.ConnectionEvent event)
end in interface Diagnosableevent - the event name