Class Log
java.lang.Object
org.jpos.util.Log
- All Implemented Interfaces:
LogSource
- Direct Known Subclasses:
BSHRequestListener, Debug, DummyPackager, FSDPackager, IncomingListener, JESpace, JSParticipant
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringLevel constant for debug events.Default tags applied to everyLogEventcreated by thisLog.static final StringLevel constant for error events.static final StringLevel constant for fatal events.static final StringLevel constant for informational events.protected LoggerLogger receiving the events produced by thisLog.protected StringRealm associated with events emitted through thisLog.static final StringLevel constant for trace events.static final StringLevel constant for warning events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LogEventapplyDefaultTags(LogEvent evt) Decoratesevtwith thisLog's default tags, if any.Creates an empty debug-level event.createDebug(Object detail) Creates a debug-level event with the given payload.Creates an empty error-level event.createError(Object detail) Creates an error-level event with the given payload.Creates an empty fatal-level event.createFatal(Object detail) Creates a fatal-level event with the given payload.Creates an empty info-level event.createInfo(Object detail) Creates an info-level event with the given payload.createLogEvent(String level) Creates a newLogEventat the given level decorated with thisLog's default tags.createLogEvent(String level, Object detail) Creates a newLogEventat the given level with an initial payload.Creates an empty trace-level event.createTrace(Object detail) Creates a trace-level event with the given payload.Creates an empty warning-level event.createWarn(Object detail) Creates a warning-level event with the given payload.voidLogs a debug event with the given detail.voidLogs a debug event with the given detail and an additional payload.voidLogs an error event with the given detail.voidLogs an error event with the given detail and an additional payload.voidLogs a fatal event with the given detail.voidLogs a fatal event with the given detail and an additional payload.Returns an unmodifiable snapshot of the current default tags.static LogConvenience factory returning aLogbound to the given logger name and realm.Returns the underlying logger.getRealm()Returns the realm associated with events emitted through thisLog.voidLogs an info event with the given detail.voidLogs an info event with the given detail and an additional payload.voidremoveDefaultTag(String key) Removes a previously-registered default tag.voidsetDefaultTag(String key, String value) Sets a default tag on every event produced by thisLog; anullvalue removes the entry.voidsetDefaultTags(Map<String, String> tags) Replaces the entire set of default tags.voidReplaces the underlying logger, leaving the realm unchanged.voidReplaces the underlying logger and realm.voidReplaces the realm associated with emitted events.voidLogs a trace event with the given detail.voidLogs a trace event with the given detail and an additional payload.voidLogs a warning event with the given detail.voidLogs a warning event with the given detail and an additional payload.
-
Field Details
-
logger
-
realm
-
defaultTags
Default tags applied to everyLogEventcreated by thisLog. -
TRACE
-
DEBUG
-
INFO
-
WARN
-
ERROR
-
FATAL
-
-
Constructor Details
-
Log
public Log()Default constructor. -
Log
-
-
Method Details
-
getLog
-
setLogger
-
getRealm
-
getLogger
-
setLogger
-
setRealm
-
setDefaultTag
Sets a default tag on every event produced by thisLog; anullvalue removes the entry.- Parameters:
key- tag name (ignored ifnull)value- tag value, ornullto remove the tag
-
removeDefaultTag
Removes a previously-registered default tag.- Parameters:
key- tag name (ignored ifnull)
-
setDefaultTags
Replaces the entire set of default tags.- Parameters:
tags- new tag set, ornull/empty to clear all tags
-
getDefaultTags
Returns an unmodifiable snapshot of the current default tags.- Returns:
- a snapshot of the registered default tags
-
applyDefaultTags
Decoratesevtwith thisLog's default tags, if any.- Parameters:
evt- the event to decorate- Returns:
- the same event (for chaining)
-
trace
-
trace
-
debug
-
debug
-
info
-
info
-
warn
-
warn
-
error
-
error
-
fatal
-
fatal
-
createLogEvent
Creates a newLogEventat the given level decorated with thisLog's default tags.- Parameters:
level- event level (one of theTRACE/DEBUG/INFO/WARN/ERROR/FATALconstants)- Returns:
- a new event ready to be populated and logged
-
createLogEvent
Creates a newLogEventat the given level with an initial payload.- Parameters:
level- event leveldetail- initial event payload- Returns:
- a new event ready to be populated and logged
-
createTrace
Creates an empty trace-level event. -
createTrace
Creates a trace-level event with the given payload. -
createDebug
Creates an empty debug-level event. -
createDebug
Creates a debug-level event with the given payload. -
createInfo
Creates an empty info-level event. -
createInfo
Creates an info-level event with the given payload. -
createWarn
Creates an empty warning-level event. -
createWarn
Creates a warning-level event with the given payload. -
createError
Creates an empty error-level event. -
createError
Creates an error-level event with the given payload. -
createFatal
Creates an empty fatal-level event. -
createFatal
Creates a fatal-level event with the given payload.
-