public class DefaultTAPLog extends DefaultUWSLog implements TAPLog
TAPLog
interface which lets logging any message about a TAP service.DefaultUWSLog
UWSLog.LogLevel
defaultOutput, fileManager, minLogLevel, uws
Constructor and Description |
---|
DefaultTAPLog(java.io.OutputStream output)
Builds a
TAPLog which will print all its
messages into the given stream. |
DefaultTAPLog(java.io.PrintWriter writer)
Builds a
TAPLog which will print all its
messages into the given stream. |
DefaultTAPLog(UWSFileManager fm)
Builds a
TAPLog which will use the given file
manager to get the log output (see UWSFileManager.getLogOutput(uws.service.log.UWSLog.LogLevel, String) ). |
Modifier and Type | Method and Description |
---|---|
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.
|
protected void |
printException(java.lang.Throwable error,
java.io.PrintWriter out)
Format and print the given exception inside the given writer.
|
canLog, debug, debug, debug, error, error, error, getConfigString, getDateFormat, getExceptionOrigin, getMinLogLevel, getOutput, info, log, log, logHttp, logHttp, logJob, logThread, logUWS, normalizeMessage, setDateFormat, setMinLogLevel, warning
public DefaultTAPLog(UWSFileManager fm)
Builds a TAPLog
which will use the given file
manager to get the log output (see UWSFileManager.getLogOutput(uws.service.log.UWSLog.LogLevel, String)
).
note 1: This constructor is particularly useful if the way of managing log output may change in the given file manager.
Indeed, the output may change in function of the type of message to log (UWSLog.LogLevel
).
note 2 If no output can be found in the file manager the standard error output (System.err
)
will be chosen automatically for all log messages.
fm
- A TAP file manager.DefaultUWSLog.DefaultUWSLog(UWSFileManager)
public DefaultTAPLog(java.io.OutputStream output)
Builds a TAPLog
which will print all its
messages into the given stream.
note: the given output will be used whatever is the type of message to log (UWSLog.LogLevel
).
output
- An output stream.DefaultUWSLog.DefaultUWSLog(OutputStream)
public DefaultTAPLog(java.io.PrintWriter writer)
Builds a TAPLog
which will print all its
messages into the given stream.
note: the given output will be used whatever is the type of message to log (UWSLog.LogLevel
).
writer
- A print writer.DefaultUWSLog.DefaultUWSLog(PrintWriter)
protected void printException(java.lang.Throwable error, java.io.PrintWriter out)
DefaultUWSLog
Format and print the given exception inside the given writer.
This function does nothing if the given error is NULL.
The full stack trace is printed ONLY for unknown exceptions.
The printed text has the following format for known exceptions:
Caused by a {ExceptionClassName} {ExceptionOrigin} {ExceptionMessage}
The printed text has the following format for unknown exceptions:
Caused by a {ExceptionFullStackTrace}
printException
in class DefaultUWSLog
error
- The exception to print.out
- The output in which the exception must be written.DefaultUWSLog.getExceptionOrigin(Throwable)
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