public class Slf4jTAPLog extends Slf4jUWSLog implements TAPLog
TAPLog
forwards all log submission to
SLF4J.
Thus, a TAP implementor can choose how to deal with logs. SLF4J already provides bridges at least for the following logging frameworks:
A different logger is used in function of the log entry's CONTEXT. Four values are supported: "UWS", "HTTP", "JOB" and "THREAD". If a different value is set for the CONTEXT, the general/root logger will be used.
The ID of each logger follows this rule:
"tap.service"{SUFFIX}
The ID of the general/root logger is just
"tap.service"
. For all the other specific
loggers, {SUFFIX}
is a dot followed by one among
"UWS",
"HTTP",
"JOB" and
"THREAD". Thus, the full ID
of the logger for the HTTP requests is:
uws.service.httpLog entries format
All log entries are formatted as follow:
{EVENT} - {ID} - {MESSAGE} - {ADDITIONAL_DATA}
{EVENT}, {ID} and {ADDITIONAL_DATA} may not be all provided for some messages ; all are optional, and especially ADDITIONAL_DATA. When not provided, each is replaced by an empty string. In the special case of ADDITIONAL_DATA, if none is provided, the " - " prefixing it is not written.
UWSLog.LogLevel
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
DB_LOG_ID_SUFFIX
Suffix to append to the root logger ID for the DATABASE logger.
|
protected org.slf4j.Logger |
dbLogger
Logger for database actions.
|
protected static java.lang.String |
DEFAULT_ROOT_LOG_ID
Default SLF4J identifier for the general/root logger to use.
|
protected static java.lang.String |
TAP_LOG_ID_SUFFIX
Suffix to append to the root logger ID for the TAP logger.
|
protected org.slf4j.Logger |
tapLogger
Logger for TAP jobs actions.
|
HTTP_LOG_ID_SUFFIX, httpLogger, JOB_LOG_ID_SUFFIX, jobLogger, rootLogger, THREAD_LOG_ID_SUFFIX, threadLogger, UWS_LOG_ID_SUFFIX, uwsLogger
Modifier | Constructor and Description |
---|---|
|
Slf4jTAPLog()
Initialise this logger.
|
protected |
Slf4jTAPLog(java.lang.String logId)
Initialise this logger with the specified SLF4J logger.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getConfigString()
Get a string representing the configuration of this logger.
|
void |
logDB(UWSLog.LogLevel level,
DBConnection connection,
java.lang.String event,
java.lang.String message,
java.lang.Throwable error)
Log a message and/or an error in the DB (database) context.
|
void |
logTAP(UWSLog.LogLevel level,
java.lang.Object obj,
java.lang.String event,
java.lang.String message,
java.lang.Throwable error)
Log a message and/or an error in the general context of TAP.
|
debug, debug, debug, error, error, error, info, log, log, logHttp, logHttp, logJob, logThread, logUWS, warning
protected static final java.lang.String DEFAULT_ROOT_LOG_ID
protected static final java.lang.String TAP_LOG_ID_SUFFIX
protected static final java.lang.String DB_LOG_ID_SUFFIX
protected final org.slf4j.Logger tapLogger
protected final org.slf4j.Logger dbLogger
public Slf4jTAPLog()
protected Slf4jTAPLog(java.lang.String logId)
public java.lang.String getConfigString()
UWSLog
The result of this function aims to be logged when the logging mechanism is successfully configured and ready to be used.
getConfigString
in interface UWSLog
getConfigString
in class Slf4jUWSLog
public void logDB(UWSLog.LogLevel level, DBConnection connection, java.lang.String event, java.lang.String message, java.lang.Throwable error)
TAPLog
Log a message and/or an error in the DB (database) context.
List of all events sent by the library (case sensitive):
logDB
in interface TAPLog
level
- Level of the log (info, warning, error, ...). SHOULD NOT be NULL, but if NULL anyway, the level SHOULD be considered as INFOconnection
- DB connection from which this log comes. MAY be NULLevent
- Event at the origin of this log or action executed by the given database connection while this log is sent. MAY be NULLmessage
- Message to log. MAY be NULLerror
- Error/Exception to log. MAY be NULLpublic void logTAP(UWSLog.LogLevel level, java.lang.Object obj, java.lang.String event, java.lang.String message, java.lang.Throwable error)
TAPLog
Log a message and/or an error in the general context of TAP.
One of the parameter is of type Object
. This object can be used to provide more information to the log function
in order to describe as much as possible the state and/or result event.
List of all events sent by the library (case sensitive):
TAPParameters
)TAPSyncJob
)TAPExecutionReport
)TAPExecutionReport
)TAPExecutionReport
)TAPExecutionReport
)TAPExecutionReport
)TAPExecutionReport
)TAPExecutionReport
)TAPExecutionReport
)TAPExecutionReport
)TAPSyncJob
)TAPSyncJob
)logTAP
in interface TAPLog
level
- Level of the log (info, warning, error, ...). SHOULD NOT be NULL, but if NULL anyway, the level SHOULD be considered as INFOobj
- Object providing more information about the event/object at the origin of this log. MAY be NULLevent
- Event at the origin of this log or action currently executed by TAP while this log is sent. MAY be NULLmessage
- Message to log. MAY be NULLerror
- Error/Exception to log. MAY be NULL