Package com.oracle.coherence.common.base
Class Logger
- java.lang.Object
-
- com.oracle.coherence.common.base.Logger
-
public abstract class Logger extends Object
Logging API.- Since:
- 20.06
- Author:
- Aleks Seovic 2020.05.18
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALWAYS
Severity 0 will always be logged.static int
CONFIG
Severity 4 indicates configuration related log message.static int
ERROR
Severity 1 indicates an error.static int
FINE
Severity 5 indicates an essential debug message.static int
FINER
Severity 6 indicates a non-essential debug message.static int
FINEST
Severity 7 indicates a very low-level, non-essential debug message or a tracing message.static int
INFO
Severity 3 indicates information that should likely be logged.static int
WARNING
Severity 2 indicates a warning.
-
Constructor Summary
Constructors Constructor Description Logger()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
config(String sMessage)
Log the specified message withCONFIG
severity.static void
config(String sMessage, Throwable e)
Log the specified message and the exception stack trace withCONFIG
severity.static void
config(Throwable e)
Log the specified exception information (message and stack trace) withCONFIG
severity.static void
config(Supplier<String> supplierMessage)
Log the specified message withCONFIG
severity.static void
config(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withCONFIG
severity.static void
entering(Class<?> clz, String sMethod, Object... params)
Entry logging.static void
err(String sMessage)
Log the specified message withERROR
severity.static void
err(String sMessage, Throwable e)
Log the specified message and the exception stack trace withERROR
severity.static void
err(Throwable e)
Log the specified exception information (message and stack trace) withERROR
severity.static void
err(Supplier<String> supplierMessage)
Log the specified message withERROR
severity.static void
err(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withERROR
severity.static void
exiting(Class<?> clz, String sMethod)
Exit logging.static void
exiting(Class<?> clz, String sMethod, Object result, Object... additionalInfo)
Exit logging.static void
fine(String sMessage)
Log the specified message withFINE
severity.static void
fine(String sMessage, Throwable e)
Log the specified message and the exception stack trace withFINE
severity.static void
fine(Throwable e)
Log the specified exception information (message and stack trace) withFINE
severity.static void
fine(Supplier<String> supplierMessage)
Log the specified message withFINE
severity.static void
fine(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withFINE
severity.static void
finer(String sMessage)
Log the specified message withFINER
severity.static void
finer(String sMessage, Throwable e)
Log the specified message and the exception stack trace withFINER
severity.static void
finer(Throwable e)
Log the specified exception information (message and stack trace) withFINER
severity.static void
finer(Supplier<String> supplierMessage)
Log the specified message withFINER
severity.static void
finer(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withFINER
severity.static void
finest(String sMessage)
Log the specified message withFINEST
severity.static void
finest(String sMessage, Throwable e)
Log the specified message and the exception stack trace withFINEST
severity.static void
finest(Throwable e)
Log the specified exception information (message and stack trace) withFINEST
severity.static void
finest(Supplier<String> supplierMessage)
Log the specified message withFINEST
severity.static void
finest(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withFINEST
severity.static void
info(String sMessage)
Log the specified message withINFO
severity.static void
info(String sMessage, Throwable e)
Log the specified message and the exception stack trace withINFO
severity.static void
info(Throwable e)
Log the specified exception information (message and stack trace) withINFO
severity.static void
info(Supplier<String> supplierMessage)
Log the specified message withINFO
severity.static void
info(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withINFO
severity.static boolean
isEnabled(int nSeverity)
Returntrue
if the specified severity level should be logged.static void
log(String sMessage, int nSeverity)
Log the specified message at the specified severity level.static void
log(String sMessage, Throwable e, int nSeverity)
Log the specified message and the exception stack trace at the specified severity level.static void
log(Throwable e, int nSeverity)
Log the specified exception information (message and stack trace) at the specified severity level.static void
log(Supplier<String> supplierMessage, int nSeverity)
Log the specified message at the specified severity level.static void
log(Supplier<String> supplierMessage, Throwable e, int nSeverity)
Log the specified message and the exception stack trace at the specified severity level.static void
out(String sMessage)
Log the specified message withALWAYS
severity.static void
out(String sMessage, Throwable e)
Log the specified message and the exception stack trace withALWAYS
severity.static void
out(Throwable e)
Log the specified exception information (message and stack trace) withALWAYS
severity.static void
out(Supplier<String> supplierMessage)
Log the specified message withALWAYS
severity.static void
out(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withALWAYS
severity.static void
setLoggingLevel(int nSeverity)
Set the logging level.static void
throwing(Class<?> clz, String sMethod, Throwable throwable, Object... additionalInfo)
Throwable logging.static void
warn(String sMessage)
Log the specified message withWARNING
severity.static void
warn(String sMessage, Throwable e)
Log the specified message and the exception stack trace withWARNING
severity.static void
warn(Throwable e)
Log the specified exception information (message and stack trace) withWARNING
severity.static void
warn(Supplier<String> supplierMessage)
Log the specified message withWARNING
severity.static void
warn(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withWARNING
severity.
-
-
-
Field Detail
-
ALWAYS
public static final int ALWAYS
Severity 0 will always be logged.- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR
Severity 1 indicates an error.- See Also:
- Constant Field Values
-
WARNING
public static final int WARNING
Severity 2 indicates a warning.- See Also:
- Constant Field Values
-
INFO
public static final int INFO
Severity 3 indicates information that should likely be logged.- See Also:
- Constant Field Values
-
CONFIG
public static final int CONFIG
Severity 4 indicates configuration related log message.- See Also:
- Constant Field Values
-
FINE
public static final int FINE
Severity 5 indicates an essential debug message.- See Also:
- Constant Field Values
-
FINER
public static final int FINER
Severity 6 indicates a non-essential debug message.- See Also:
- Constant Field Values
-
FINEST
public static final int FINEST
Severity 7 indicates a very low-level, non-essential debug message or a tracing message.- See Also:
- Constant Field Values
-
-
Method Detail
-
isEnabled
public static boolean isEnabled(int nSeverity)
Returntrue
if the specified severity level should be logged.- Parameters:
nSeverity
- the severity level- Returns:
true
if the specified severity level should be logged;false
otherwise
-
log
public static void log(String sMessage, int nSeverity)
Log the specified message at the specified severity level.- Parameters:
sMessage
- the message to lognSeverity
- the severity level
-
log
public static void log(Supplier<String> supplierMessage, int nSeverity)
Log the specified message at the specified severity level. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggednSeverity
- the severity level
-
log
public static void log(String sMessage, Throwable e, int nSeverity)
Log the specified message and the exception stack trace at the specified severity level.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace fornSeverity
- the severity level
-
log
public static void log(Supplier<String> supplierMessage, Throwable e, int nSeverity)
Log the specified message and the exception stack trace at the specified severity level. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace fornSeverity
- the severity level
-
log
public static void log(Throwable e, int nSeverity)
Log the specified exception information (message and stack trace) at the specified severity level.- Parameters:
e
- the exception to lognSeverity
- the severity level
-
out
public static void out(String sMessage)
Log the specified message withALWAYS
severity.- Parameters:
sMessage
- the message to log
-
out
public static void out(Supplier<String> supplierMessage)
Log the specified message withALWAYS
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
out
public static void out(String sMessage, Throwable e)
Log the specified message and the exception stack trace withALWAYS
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
out
public static void out(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withALWAYS
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
out
public static void out(Throwable e)
Log the specified exception information (message and stack trace) withALWAYS
severity.- Parameters:
e
- the exception to log
-
err
public static void err(String sMessage)
Log the specified message withERROR
severity.- Parameters:
sMessage
- the message to log
-
err
public static void err(Supplier<String> supplierMessage)
Log the specified message withERROR
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
err
public static void err(String sMessage, Throwable e)
Log the specified message and the exception stack trace withERROR
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
err
public static void err(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withERROR
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
err
public static void err(Throwable e)
Log the specified exception information (message and stack trace) withERROR
severity.- Parameters:
e
- the exception to log
-
warn
public static void warn(String sMessage)
Log the specified message withWARNING
severity.- Parameters:
sMessage
- the message to log
-
warn
public static void warn(Supplier<String> supplierMessage)
Log the specified message withWARNING
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
warn
public static void warn(String sMessage, Throwable e)
Log the specified message and the exception stack trace withWARNING
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
warn
public static void warn(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withWARNING
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
warn
public static void warn(Throwable e)
Log the specified exception information (message and stack trace) withWARNING
severity.- Parameters:
e
- the exception to log
-
info
public static void info(String sMessage)
Log the specified message withINFO
severity.- Parameters:
sMessage
- the message to log
-
info
public static void info(Supplier<String> supplierMessage)
Log the specified message withINFO
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
info
public static void info(String sMessage, Throwable e)
Log the specified message and the exception stack trace withINFO
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
info
public static void info(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withINFO
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
info
public static void info(Throwable e)
Log the specified exception information (message and stack trace) withINFO
severity.- Parameters:
e
- the exception to log
-
config
public static void config(String sMessage)
Log the specified message withCONFIG
severity.- Parameters:
sMessage
- the message to log
-
config
public static void config(Supplier<String> supplierMessage)
Log the specified message withCONFIG
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
config
public static void config(String sMessage, Throwable e)
Log the specified message and the exception stack trace withCONFIG
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
config
public static void config(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withCONFIG
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
config
public static void config(Throwable e)
Log the specified exception information (message and stack trace) withCONFIG
severity.- Parameters:
e
- the exception to log
-
fine
public static void fine(String sMessage)
Log the specified message withFINE
severity.- Parameters:
sMessage
- the message to log
-
fine
public static void fine(Supplier<String> supplierMessage)
Log the specified message withFINE
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
fine
public static void fine(String sMessage, Throwable e)
Log the specified message and the exception stack trace withFINE
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
fine
public static void fine(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withFINE
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
fine
public static void fine(Throwable e)
Log the specified exception information (message and stack trace) withFINE
severity.- Parameters:
e
- the exception to log
-
finer
public static void finer(String sMessage)
Log the specified message withFINER
severity.- Parameters:
sMessage
- the message to log
-
finer
public static void finer(Supplier<String> supplierMessage)
Log the specified message withFINER
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
finer
public static void finer(String sMessage, Throwable e)
Log the specified message and the exception stack trace withFINER
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
finer
public static void finer(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withFINER
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
finer
public static void finer(Throwable e)
Log the specified exception information (message and stack trace) withFINER
severity.- Parameters:
e
- the exception to log
-
finest
public static void finest(String sMessage)
Log the specified message withFINEST
severity.- Parameters:
sMessage
- the message to log
-
finest
public static void finest(Supplier<String> supplierMessage)
Log the specified message withFINEST
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be logged
-
finest
public static void finest(String sMessage, Throwable e)
Log the specified message and the exception stack trace withFINEST
severity.- Parameters:
sMessage
- the message to loge
- the exception to log the stack trace for
-
finest
public static void finest(Supplier<String> supplierMessage, Throwable e)
Log the specified message and the exception stack trace withFINEST
severity. The message is provided by theSupplier
, which will only be evaluated if the messages should be logged at the specified severity level. This avoids potentially expensive message construction if the message isn't going to be logged.- Parameters:
supplierMessage
- the supplier of the message to log; only evaluated if the specified severity level should be loggede
- the exception to log the stack trace for
-
finest
public static void finest(Throwable e)
Log the specified exception information (message and stack trace) withFINEST
severity.- Parameters:
e
- the exception to log
-
entering
public static void entering(Class<?> clz, String sMethod, Object... params)
Entry logging.- Parameters:
clz
- the sourceClass
sMethod
- the source methodparams
- zero or more parameters to log- Throws:
NullPointerException
- if eitherclz
orsMethod
arenull
- Since:
- 22.06
-
exiting
public static void exiting(Class<?> clz, String sMethod)
Exit logging.- Parameters:
clz
- the sourceClass
sMethod
- the source method- Throws:
NullPointerException
- if eitherclz
orsMethod
arenull
- Since:
- 22.06
-
exiting
public static void exiting(Class<?> clz, String sMethod, Object result, Object... additionalInfo)
Exit logging.- Parameters:
clz
- the sourceClass
sMethod
- the source methodresult
- the result returned by the exiting methodadditionalInfo
- zero or more additional state details at the time of exit- Throws:
NullPointerException
- if eitherclz
orsMethod
arenull
- Since:
- 22.06
-
throwing
public static void throwing(Class<?> clz, String sMethod, Throwable throwable, Object... additionalInfo)
Throwable logging.- Parameters:
clz
- the sourceClass
sMethod
- the source methodthrowable
- theException
being thrownadditionalInfo
- zero or more additional state details at the time of exit- Throws:
NullPointerException
- if any arguments arenull
- Since:
- 22.06
-
setLoggingLevel
public static void setLoggingLevel(int nSeverity)
Set the logging level.- Parameters:
nSeverity
- the severity level- Since:
- 22.09
-
-