public final class Log
extends java.lang.Object
setDebugLevel(Debug.DEBUG_LEVEL_WARNING);| Modifier and Type | Field and Description |
|---|---|
static int |
DEBUG_LAYER_ALL
Should be used to show all debug messages.
|
static int |
DEBUG_LAYER_APPLICATION
Should be used to show application layer (device+service) debug messages
|
static int |
DEBUG_LAYER_COMMUNICATION
Should be used to show communication layer debug messages.
|
static int |
DEBUG_LAYER_FRAMEWORK
Should be used to show general framework debug messages.
|
static int |
DEBUG_LEVEL_DEBUG
Sets highest output level, every message shown.
|
static int |
DEBUG_LEVEL_ERROR
Sets level to show error messages only.
|
static int |
DEBUG_LEVEL_INFO
Sets level to show information, warn and error messages only.
|
static int |
DEBUG_LEVEL_NO_LOGGING
Sets level to show error messages only.
|
static int |
DEBUG_LEVEL_WARN
Sets level to show warn and error messages only.
|
| Constructor and Description |
|---|
Log() |
| Modifier and Type | Method and Description |
|---|---|
static void |
debug(java.lang.String msg)
Logs a debug message.
Use this for debugging messages. The message is logged only when the current debug level is >= DEBUG_LEVEL_DEBUG. |
static void |
debug(java.lang.String msg,
int layer)
Logs a debug message.
Use this for debugging messages. The message is logged only when the current debug level is >= DEBUG_LEVEL_DEBUG. |
static void |
error(java.lang.String msg)
Logs an error message.
Use this for messages regarding critical errors. The message is logged only when the current debug level is >= DEBUG_LEVEL_ERROR. |
static int |
getLogLevel()
Gets the internal debug level for this logger.
|
static java.lang.String[] |
getStackTrace(java.lang.Throwable t)
Returns the Java VM stack trace if possible.
|
static void |
info(java.lang.String msg)
Logs an info message.
Use this for informational messages. The message is logged only when the current debug level is >= DEBUG_LEVEL_INFO. |
static boolean |
isDebug()
Checks whether the current log level is at least
DEBUG_LEVEL_DEBUG. |
static boolean |
isError()
Checks whether the current log level is at least
DEBUG_LEVEL_ERROR. |
static boolean |
isInfo()
Checks whether the current log level is at least
DEBUG_LEVEL_INFO. |
static boolean |
isShowTimestamps() |
static boolean |
isWarn()
Checks whether the current log level is at least
DEBUG_LEVEL_WARN. |
protected static void |
msgout(int level,
java.lang.String msg)
Prints messages on System.out depending on debug level.
|
static void |
printStackTrace(java.lang.Throwable t)
Prints stack trace, if debug level is "Error" or higher and logging of stack traces is on.
|
static void |
setErrorOutput(java.io.PrintStream newout) |
static void |
setLogLevel(int level)
Sets the internal debug level for this logger.
|
static void |
setLogLevel(int level,
int layers)
Sets the internal debug level for this logger.
|
static void |
setLogStackTrace(boolean logStackTrace)
Sets logging of stack traces on or off.
|
static void |
setNormalOutput(java.io.PrintStream newout) |
static void |
setShowTimestamp(boolean set)
Sets time stamp on or off.
|
protected static java.lang.String |
showTimestamp()
Generates time stamp (hour:minute:second.millisecond).
|
static void |
subscribe(LogSubscriber ds)
Subscribes to notification list for receiving debug messages.
|
static void |
unsubscribe(LogSubscriber ds)
Unsubscribes from notification list.
|
static void |
warn(java.lang.String msg)
Logs a warning message.
Use this for messages about malfunctions which are not so severe to be treated as errors. The message is logged only when the current debug level is >= DEBUG_LEVEL_WARN. |
public static final int DEBUG_LAYER_ALL
public static final int DEBUG_LAYER_FRAMEWORK
public static final int DEBUG_LAYER_APPLICATION
public static final int DEBUG_LAYER_COMMUNICATION
public static final int DEBUG_LEVEL_DEBUG
public static final int DEBUG_LEVEL_INFO
public static final int DEBUG_LEVEL_WARN
public static final int DEBUG_LEVEL_ERROR
public static final int DEBUG_LEVEL_NO_LOGGING
public static void setShowTimestamp(boolean set)
set - true if Debug should show time stamps, false if not.public static void setLogStackTrace(boolean logStackTrace)
logStackTrace - true if Debug should log stack traces, false if not.public static void setLogLevel(int level,
int layers)
The set layers could be a single layer or a combination of them
level - the debug level to set.layers - the layers which debug messages should be shown for.DEBUG_LAYER_ALL,
DEBUG_LAYER_APPLICATION,
DEBUG_LAYER_COMMUNICATION,
DEBUG_LAYER_FRAMEWORKpublic static int getLogLevel()
public static void setLogLevel(int level)
level - the debug level to set.public static boolean isShowTimestamps()
public static boolean isDebug()
DEBUG_LEVEL_DEBUG.DEBUG_LEVEL_DEBUG or notpublic static boolean isInfo()
DEBUG_LEVEL_INFO.DEBUG_LEVEL_INFO or notpublic static boolean isWarn()
DEBUG_LEVEL_WARN.DEBUG_LEVEL_WARN or notpublic static boolean isError()
DEBUG_LEVEL_ERROR.DEBUG_LEVEL_ERROR or notprotected static java.lang.String showTimestamp()
public static void debug(java.lang.String msg)
msg - the message to log.public static void debug(java.lang.String msg,
int layer)
msg - the message to log.public static void info(java.lang.String msg)
msg - the message to log.public static void error(java.lang.String msg)
msg - the message to log.public static void warn(java.lang.String msg)
msg - the message to log.protected static void msgout(int level,
java.lang.String msg)
level - in the range from 1..5, or use one of the predefined constants.msg - the message to log.public static void printStackTrace(java.lang.Throwable t)
t - the throwable.public static java.lang.String[] getStackTrace(java.lang.Throwable t)
Can return null if the platform does not support access to the stack trace!
t - stack traceString.public static void subscribe(LogSubscriber ds)
ds - an object wants to subscribe for debug messages.LogSubscriberpublic static void unsubscribe(LogSubscriber ds)
ds - an object wants to unsubscribe form debug messagesLogSubscriberpublic static void setNormalOutput(java.io.PrintStream newout)
public static void setErrorOutput(java.io.PrintStream newout)