This is the main entry point to MonDemand. Users can create client objects and use them to
log messages and statistics.
addContext
public void addContext(String key,
String value) Adds contextual data to the client.
addTransport
public void addTransport(Transport transport)
Adds a new transport to this client.
transport - the transport object to add
alert
public void alert(String message)
A convenience method to log a message at priority level ALERT
message - the log message
alert
public void alert(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message a priority level ALERT.
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
alert
public void alert(TraceId traceId,
String message,
Object[] args) Logs a message a priority level ALERT, determining the calling class and
line number on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments
crit
public void crit(String message)
A convenience method to log a message at priority level CRIT
message - the log message
crit
public void crit(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message at priority level CRIT
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
crit
public void crit(TraceId traceId,
String message,
Object[] args) Logs a message a priority level CRIT, determining the calling class and
line number on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments
debug
public void debug(String message)
A convenience method to log a message at priority level DEBUG
message - the log message
debug
public void debug(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message at priority level DEBUG
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
debug
public void debug(TraceId traceId,
String message,
Object[] args) Logs a message a priority level DEBUG, determining the calling class and
line number on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments
decrement
public void decrement()
Decrements the default counter by one.
decrement
public void decrement(String key)
Decrements the specified counter by one.
key - the name of the counter to decrement
decrement
public void decrement(String key,
int value) Decrements the specified counter by the value specified.
key - the name of the counter to decrementvalue - the amount to decrement the counter by
decrement
public void decrement(int value)
Decrements the default counter by value
value - the amount to decrement the counter by
emerg
public void emerg(String message)
A convenience method to log a message a log level EMERG.
emerg
public void emerg(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message at priority level EMERG
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
emerg
public void emerg(TraceId traceId,
String message,
Object[] args) Logs a message a priority level EMERG, determining the calling class and line number
on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments
error
public void error(String message)
A convenience method to log a message at priority level ERROR
message - the log message
error
public void error(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message at priority level ERROR
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
error
public void error(TraceId traceId,
String message,
Object[] args) Logs a message a priority level ERROR, determining the calling class and
line number on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments
finalize
public void finalize()
Called when the client is destroyed. Ensures that everything is cleaned up properly.
flushLogs
public void flushLogs()
Flushes log data to the transports.
flushStats
public void flushStats()
Flushes statistics to the transports.
flushStats
public void flushStats(boolean reset)
Flushes statistics to the transports, but allows one to specify whether or not to reset the
running statistics.
getContext
public String getContext(String key)
Fetches contextual data from the client.
getContextKeys
public Enumeration getContextKeys()
Retrieves an enumeration of all the contextual data keys
- an enumeration of all keys
getImmediateSendLevel
public int getImmediateSendLevel()
getNoSendLevel
public int getNoSendLevel()
getProgramId
public String getProgramId()
increment
public void increment()
Increments the default counter by one.
increment
public void increment(String key)
Increments the specified counter by one.
key - the name of the counter to increment
increment
public void increment(String key,
int value) Increments the specified counter by the value specified.
key - the name of the counter to incrementvalue - the amount to increment the counter by
increment
public void increment(int value)
Increments the default counter by value
value - the amount to increment the counter by
info
public void info(String message)
A convenience method to log a message at priority level INFO
message - the log message
info
public void info(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message at priority level INFO
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
info
public void info(TraceId traceId,
String message,
Object[] args) Logs a message a priority level INFO, determining the calling class and
line number on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments
levelIsEnabled
public boolean levelIsEnabled(int level,
TraceId traceId) A check for the log level that is set.
level - the priority level to checktraceId - the TraceId to check for
- true if this level is enabled, false otherwise
log
public void log(String name,
int line,
int level,
TraceId traceId,
String message,
Object[] args) The most generic logger function.
name - the name of this message, usually the filename or calling classline - the line number calling this message, or other numeric description of the calling classlevel - the log leveltraceId - an optional traceIdmessage - the messageargs - optional arguments
log
public void log(int level,
TraceId traceId,
String message,
Object[] args) Generic logger function. This method will perform slower than most because it needs to detect
the calling class and calling line number.
level - the log level of this messagetraceId - an optional traceIdmessage - the log messageargs - optional arguments
notice
public void notice(String message)
A convenience method to log a message at priority level NOTICE
message - the log message
notice
public void notice(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message at priority level NOTICE
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
notice
public void notice(TraceId traceId,
String message,
Object[] args) Logs a message a priority level NOTICE, determining the calling class and
line number on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments
removeAllContexts
public void removeAllContexts()
Clear contextual data from the logger. Contextual data persists between
flush() calls and is only removed if you call removeAllContexts().
removeContext
public void removeContext(String key)
Removes contextual data from the client.
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
Sets a custom error handler. Cowardly refuses to set it to null.
errorHandler - the errorHandler to set
setImmediateSendLevel
public void setImmediateSendLevel(int immediateSendLevel)
immediateSendLevel - the immediateSendLevel to set
setKey
public void setKey(String key,
int value) Sets the counter to the specified val ue.
key - the name of the counter key to setvalue - the value to set this counter to
setKey
public void setKey(String key,
long value) Sets the counter to the specified val ue.
key - the name of the counter key to setvalue - the value to set this counter to
setNoSendLevel
public void setNoSendLevel(int noSendLevel)
noSendLevel - the noSendLevel to set
setProgramId
public void setProgramId(String programId)
programId - the programId to set
warning
public void warning(String message)
A convenience method to log a message at priority level WARNING
message - the log message
warning
public void warning(String name,
int line,
TraceId traceId,
String message,
Object[] args) Logs a message at priority level WARNING
name - the name of the calling class or filenameline - the line number of the calling class or filenametraceId - an optional trace IDmessage - the log messageargs - optional arguments
warning
public void warning(TraceId traceId,
String message,
Object[] args) Logs a message a priority level WARNING, determining the calling class and
line number on the fly.
traceId - an optional trace IDmessage - the log messageargs - optional arguments