|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ws4d.java.util.Log
public final class Log
Debug class provides logging mechanism and control over the output messages.
Use this instead of System.out.println().
To change the debug level and the message output, use setDebugLevel(int
level).
e.g.
setDebugLevel(Debug.DEBUG_LEVEL_WARNING);
DEBUG_LEVEL_DEBUG = highest output level, every message shown.
DEBUG_LEVEL_INFO = show information, log, warn and error messages only.
DEBUG_LEVEL_LOG = show log, warn and error messages only.
DEBUG_LEVEL_WARN = show warn and error messages only.
DEBUG_LEVEL_ERROR = show error messages only.
DEBUG_LEVEL_NO_LOGGING = show nothing.
Field Summary | |
---|---|
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 (DPWS) 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 Summary | |
---|---|
Log()
|
Method Summary | |
---|---|
static void |
debug(java.lang.String msg)
Logs a debug message. |
static void |
debug(java.lang.String msg,
int layer)
Logs a debug message. |
static void |
error(java.lang.String msg)
Logs an error message. |
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. |
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 |
isWarn()
Checks whether the current log level is at least DEBUG_LEVEL_WARN . |
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.OutputStream 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.OutputStream newout)
|
static void |
setShowTimestamp(boolean set)
Sets time stamp on or off. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public Log()
Method Detail |
---|
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)
level
- the debug level to set.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_FRAMEWORK
public static int getLogLevel()
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 notpublic 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.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 trace
String
.public static void subscribe(LogSubscriber ds)
ds
- an object wants to subscribe for debug messages.LogSubscriber
public static void unsubscribe(LogSubscriber ds)
ds
- an object wants to unsubscribe form debug messagesLogSubscriber
public static void setNormalOutput(java.io.OutputStream newout)
public static void setErrorOutput(java.io.OutputStream newout)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |