com.funambol.util
Class Log

java.lang.Object
  extended by com.funambol.util.Log

public class Log
extends java.lang.Object

Generic Log class


Field Summary
static int DEBUG
          Log level DEBUG: used to log debug messages.
static int DISABLED
          Log level DISABLED: used to speed up applications using logging features
static int ERROR
          Log level ERROR: used to log error messages.
static int INFO
          Log level INFO: used to log information messages.
static int TRACE
          Log level TRACE: used to trace the program execution.
 
Method Summary
static void debug(java.lang.Object obj, java.lang.String msg)
          DEBUG: Information message
static void debug(java.lang.String msg)
          DEBUG: Debug message
static void debug(java.lang.String tag, java.lang.String msg)
          DEBUG: Information message
static void deleteLog()
          Delete log file
static void enableContextLogging(boolean contextLogging)
          Enabled/disable the context logging feature.
static void error(java.lang.Object obj, java.lang.String msg)
          ERROR: Error message
static void error(java.lang.String msg)
          ERROR: Error message
static void error(java.lang.String tag, java.lang.String msg)
          ERROR: Error message
static void error(java.lang.String tag, java.lang.String msg, java.lang.Throwable e)
          ERROR: Error message
static Appender getAppender()
          Return a reference to the current appender
static LogContent getCurrentLogContent()
          Return the current log appender LogContent container object
static int getLogLevel()
          Accessor method to retrieve log level:
static void info(java.lang.Object obj, java.lang.String msg)
          INFO: Information message
static void info(java.lang.String msg)
          INFO: Information message
static void info(java.lang.String tag, java.lang.String msg)
          INFO: Information message
static void initLog(Appender object)
          Ititialize log file
static void initLog(Appender object, int level)
          Initialize log file with a specific appender and log level.
static void initLog(Appender object, int level, int cacheSize)
          Initialize log file with a specific appender and log level.
static void memoryStats(java.lang.Object obj, java.lang.String msg)
          Dump memory statistics at this point.
static void memoryStats(java.lang.String msg)
          Dump memory statistics at this point.
static void setClientMaxLogLevel(int clientMaxLogLevel)
          Allow clients to specify their maximum log level.
static void setLogLevel(int newlevel)
          Accessor method to define log level:
static void stats(java.lang.Object obj, java.lang.String msg)
          Dump time statistics at this point.
static void stats(java.lang.String msg)
          Dump time statistics at this point.
static void timeStats(java.lang.Object obj, java.lang.String msg)
          Dump time statistics at this point.
static void timeStats(java.lang.String msg)
          Dump time statistics at this point.
static void trace(java.lang.Object obj, java.lang.String msg)
          TRACE: Information message
static void trace(java.lang.String msg)
          TRACE: Debugger mode
static void trace(java.lang.String tag, java.lang.String msg)
          TRACE: Information message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISABLED

public static final int DISABLED
Log level DISABLED: used to speed up applications using logging features

See Also:
Constant Field Values

ERROR

public static final int ERROR
Log level ERROR: used to log error messages.

See Also:
Constant Field Values

INFO

public static final int INFO
Log level INFO: used to log information messages.

See Also:
Constant Field Values

DEBUG

public static final int DEBUG
Log level DEBUG: used to log debug messages.

See Also:
Constant Field Values

TRACE

public static final int TRACE
Log level TRACE: used to trace the program execution.

See Also:
Constant Field Values
Method Detail

initLog

public static void initLog(Appender object,
                           int level)
Initialize log file with a specific appender and log level. Contextual errors handling is disabled after this call.

Parameters:
object - the appender object that write log file
level - the log level

initLog

public static void initLog(Appender object,
                           int level,
                           int cacheSize)
Initialize log file with a specific appender and log level. Contextual errors handling is enabled after this call.

Parameters:
object - the appender object that write log file
level - the log level
cacheSize - the max number of log messages cached before an error is dumped

initLog

public static void initLog(Appender object)
Ititialize log file

Parameters:
object - the appender object that write log file

getAppender

public static Appender getAppender()
Return a reference to the current appender


enableContextLogging

public static void enableContextLogging(boolean contextLogging)
Enabled/disable the context logging feature. When this feature is on, any call to Log.error will trigger the dump of the error context.


setClientMaxLogLevel

public static void setClientMaxLogLevel(int clientMaxLogLevel)
Allow clients to specify their maximum log level. By default this value is set to TRACE.


deleteLog

public static void deleteLog()
Delete log file


setLogLevel

public static void setLogLevel(int newlevel)
Accessor method to define log level:

Parameters:
newlevel - log level to be set

getLogLevel

public static int getLogLevel()
Accessor method to retrieve log level:

Returns:
actual log level

error

public static void error(java.lang.String msg)
ERROR: Error message

Parameters:
msg - the message to be logged

error

public static void error(java.lang.Object obj,
                         java.lang.String msg)
ERROR: Error message

Parameters:
msg - the message to be logged
obj - the object that send error message

error

public static void error(java.lang.String tag,
                         java.lang.String msg)
ERROR: Error message

Parameters:
msg - the message to be logged
tag - the tag characterizing the log message initiator

error

public static void error(java.lang.String tag,
                         java.lang.String msg,
                         java.lang.Throwable e)
ERROR: Error message

Parameters:
msg - the message to be logged
tag - the tag characterizing the log message initiator
e - the exception that caused the error

info

public static void info(java.lang.String msg)
INFO: Information message

Parameters:
msg - the message to be logged

info

public static void info(java.lang.Object obj,
                        java.lang.String msg)
INFO: Information message

Parameters:
msg - the message to be logged
obj - the object that send log message

info

public static void info(java.lang.String tag,
                        java.lang.String msg)
INFO: Information message

Parameters:
msg - the message to be logged
tag - the tag characterizing the log message initiator

debug

public static void debug(java.lang.String msg)
DEBUG: Debug message

Parameters:
msg - the message to be logged

debug

public static void debug(java.lang.String tag,
                         java.lang.String msg)
DEBUG: Information message

Parameters:
msg - the message to be logged
tag - the tag characterizing the log message initiator

debug

public static void debug(java.lang.Object obj,
                         java.lang.String msg)
DEBUG: Information message

Parameters:
msg - the message to be logged
obj - the object that send log message

trace

public static void trace(java.lang.String msg)
TRACE: Debugger mode


trace

public static void trace(java.lang.Object obj,
                         java.lang.String msg)
TRACE: Information message

Parameters:
msg - the message to be logged
obj - the object that send log message

trace

public static void trace(java.lang.String tag,
                         java.lang.String msg)
TRACE: Information message

Parameters:
msg - the message to be logged
tag - the tag characterizing the log message initiator

memoryStats

public static void memoryStats(java.lang.String msg)
Dump memory statistics at this point. Dump if level >= DEBUG.

Parameters:
msg - message to be logged

memoryStats

public static void memoryStats(java.lang.Object obj,
                               java.lang.String msg)
Dump memory statistics at this point.

Parameters:
obj - caller object
msg - message to be logged

timeStats

public static void timeStats(java.lang.String msg)
Dump time statistics at this point.

Parameters:
msg - message to be logged

timeStats

public static void timeStats(java.lang.Object obj,
                             java.lang.String msg)
Dump time statistics at this point.

Parameters:
obj - caller object
msg - message to be logged

stats

public static void stats(java.lang.String msg)
Dump time statistics at this point.

Parameters:
msg - message to be logged

stats

public static void stats(java.lang.Object obj,
                         java.lang.String msg)
Dump time statistics at this point.

Parameters:
obj - caller object
msg - message to be logged

getCurrentLogContent

public static LogContent getCurrentLogContent()
                                       throws java.io.IOException
Return the current log appender LogContent container object

Throws:
java.io.IOException


Copyright © 2001-2009 Funambol.