Package fr.gouv.vitam.common.logging
Class AbstractVitamLogger
- java.lang.Object
-
- fr.gouv.vitam.common.logging.AbstractVitamLogger
-
- All Implemented Interfaces:
VitamLogger
,java.io.Serializable
public abstract class AbstractVitamLogger extends java.lang.Object implements VitamLogger, java.io.Serializable
This class implements all methods that have aVitamLogLevel
parameter by default to call specific logger methods such asVitamLogger.info(String)
orVitamLogger.isInfoEnabled()
.
Inspired from Netty A skeletal implementation ofVitamLogger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractVitamLogger(java.lang.String name)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
debug(java.lang.Throwable t)
Log an exception (throwable) at the DEBUG level.void
error(java.lang.Throwable t)
Log an exception (throwable) at the ERROR level.void
info(java.lang.Throwable t)
Log an exception (throwable) at the INFO level.boolean
isEnabled(VitamLogLevel level)
Is the logger instance enabled for the specifiedlevel
?void
log(VitamLogLevel level, java.lang.String msg)
Log a message at the specifiedlevel
.void
log(VitamLogLevel level, java.lang.String format, java.lang.Object arg)
Log a message at the specifiedlevel
according to the specified format and argument.void
log(VitamLogLevel level, java.lang.String format, java.lang.Object... arguments)
Log a message at the specifiedlevel
according to the specified format and arguments.void
log(VitamLogLevel level, java.lang.String format, java.lang.Object argA, java.lang.Object argB)
Log a message at the specifiedlevel
according to the specified format and arguments.void
log(VitamLogLevel level, java.lang.String msg, java.lang.Throwable cause)
Log an exception (throwable) at the specifiedlevel
with an accompanying message.void
log(VitamLogLevel level, java.lang.Throwable cause)
Log an exception (throwable) at the specifiedlevel
.java.lang.String
name()
Return the name of thisVitamLogger
instance.protected java.lang.Object
readResolve()
static java.lang.String
simpleClassName(java.lang.Class<?> clazz)
static java.lang.String
simpleClassName(java.lang.Object o)
java.lang.String
toString()
void
trace(java.lang.Throwable t)
Log an exception (throwable) at the TRACE level.void
warn(java.lang.Throwable t)
Log an exception (throwable) at the WARN level.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.gouv.vitam.common.logging.VitamLogger
debug, debug, debug, debug, debug, error, error, error, error, error, getLevel, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, setLevel, timeInfo, timeInfo, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn
-
-
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:VitamLogger
Return the name of thisVitamLogger
instance.- Specified by:
name
in interfaceVitamLogger
- Returns:
- name of this logger instance
-
isEnabled
public boolean isEnabled(VitamLogLevel level)
Description copied from interface:VitamLogger
Is the logger instance enabled for the specifiedlevel
?- Specified by:
isEnabled
in interfaceVitamLogger
- Returns:
- True if this Logger is enabled for the specified
level
, false otherwise.
-
trace
public void trace(java.lang.Throwable t)
Description copied from interface:VitamLogger
Log an exception (throwable) at the TRACE level.- Specified by:
trace
in interfaceVitamLogger
- Parameters:
t
- the exception (throwable) to log
-
debug
public void debug(java.lang.Throwable t)
Description copied from interface:VitamLogger
Log an exception (throwable) at the DEBUG level.- Specified by:
debug
in interfaceVitamLogger
- Parameters:
t
- the exception (throwable) to log
-
info
public void info(java.lang.Throwable t)
Description copied from interface:VitamLogger
Log an exception (throwable) at the INFO level.- Specified by:
info
in interfaceVitamLogger
- Parameters:
t
- the exception (throwable) to log
-
warn
public void warn(java.lang.Throwable t)
Description copied from interface:VitamLogger
Log an exception (throwable) at the WARN level.- Specified by:
warn
in interfaceVitamLogger
- Parameters:
t
- the exception (throwable) to log
-
error
public void error(java.lang.Throwable t)
Description copied from interface:VitamLogger
Log an exception (throwable) at the ERROR level.- Specified by:
error
in interfaceVitamLogger
- Parameters:
t
- the exception (throwable) to log
-
log
public void log(VitamLogLevel level, java.lang.String msg, java.lang.Throwable cause)
Description copied from interface:VitamLogger
Log an exception (throwable) at the specifiedlevel
with an accompanying message.- Specified by:
log
in interfaceVitamLogger
msg
- the message accompanying the exceptioncause
- the exception (throwable) to log
-
log
public void log(VitamLogLevel level, java.lang.Throwable cause)
Description copied from interface:VitamLogger
Log an exception (throwable) at the specifiedlevel
.- Specified by:
log
in interfaceVitamLogger
cause
- the exception (throwable) to log
-
log
public void log(VitamLogLevel level, java.lang.String msg)
Description copied from interface:VitamLogger
Log a message at the specifiedlevel
.- Specified by:
log
in interfaceVitamLogger
msg
- the message string to be logged
-
log
public void log(VitamLogLevel level, java.lang.String format, java.lang.Object arg)
Description copied from interface:VitamLogger
Log a message at the specifiedlevel
according to the specified format and argument.This form avoids superfluous object creation when the logger is disabled for the specified
level
.- Specified by:
log
in interfaceVitamLogger
format
- the format stringarg
- the argument
-
log
public void log(VitamLogLevel level, java.lang.String format, java.lang.Object argA, java.lang.Object argB)
Description copied from interface:VitamLogger
Log a message at the specifiedlevel
according to the specified format and arguments.This form avoids superfluous object creation when the logger is disabled for the specified
level
.- Specified by:
log
in interfaceVitamLogger
format
- the format stringargA
- the first argumentargB
- the second argument
-
log
public void log(VitamLogLevel level, java.lang.String format, java.lang.Object... arguments)
Description copied from interface:VitamLogger
Log a message at the specifiedlevel
according to the specified format and arguments.This form avoids superfluous string concatenation when the logger is disabled for the specified
level
. However, this variant incurs the hidden (and relatively small) cost of creating anObject[]
before invoking the method, even if this logger is disabled for the specifiedlevel
. The variants takingone
andtwo
arguments exist solely in order to avoid this hidden cost.- Specified by:
log
in interfaceVitamLogger
format
- the format stringarguments
- a list of 3 or more arguments
-
readResolve
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
- Throws:
java.io.ObjectStreamException
-
simpleClassName
public static final java.lang.String simpleClassName(java.lang.Object o)
- Parameters:
o
- the object to get its class name- Returns:
- the simple Class Name
-
simpleClassName
public static final java.lang.String simpleClassName(java.lang.Class<?> clazz)
- Parameters:
clazz
- instance of a class- Returns:
- the simple Class Name
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-