public class Logger
Logger
provides a mechanism for tracking log messages. By default Isomorphic SmartClient server-side logging is based on Apache's open source log4j API, although there is a possibility to use other logging frameworks via Quality Open Software's (QOS.ch) Simple Logging Facade for Java (slf4j) API. For more general information on log4j, see this " Short introduction to log4j" on the Apache website. For more general information on slf4j, see this "SLF4J user manual" on the QOSs.ch website. Search for "serverLogging" in SmartClient Reference for information on how to switch between logging frameworks. The logging priorities used in the Isomorphic SmartClient framework are:
fatal
--unrecoverable error, the program will probably crash (if slf4j is used, then this will also use error
priority, as slf4j does not support fatal
priority)error
--recoverable error, the program may become unstablewarning
--unusual data or a risky operation is about to be attemptedinfo
--interesting events worth notingdebug
--any message that aids in debugging to track system progress The methods in the Logger
class can be used to log debug, warning, or error messages from classes running in the Isomorphic SmartClient environment. To create a new logger to track messages by class name, place the following line of code at the top of the class definition:
private static Logger log = new Logger(myClass.class.getName());
Constructor and Description |
---|
Logger(java.lang.Class objClass) Constructs Logger object using className of provided Class as logging category. |
Logger(java.lang.String subsystem) Constructs Logger object using provided subsystem as logging category. |
Modifier and Type | Method and Description |
---|---|
void | debug(java.lang.Object message) Logs a message with " debug " status. |
void | error(java.lang.Object message) Logs a message with " error " status. |
void | fatal(java.lang.Object message) Logs a message with " fatal " status. |
void | info(java.lang.Object message, java.lang.Throwable t) Logs a message with " info " status. |
boolean | isDebugEnabled() Checks if the logger has been enabled to allow debug messages. |
boolean | isErrorEnabled() Checks if the logger has been enabled to allow error messages. |
boolean | isFatalEnabled() Checks if the logger has been enabled to allow fatal messages. |
boolean | isInfoEnabled() Checks if the logger has been enabled to allow info messages. |
boolean | isWarnEnabled() Checks if the logger has been enabled to allow warning messages. |
void | warning(java.lang.Object message) Logs a message with " warning " status. |
public Logger(java.lang.Class objClass)
Logger
object using className of provided Class
as logging category.public Logger(java.lang.String subsystem)
Logger
object using provided subsystem
as logging category.public void fatal(java.lang.Object message)
fatal
" status.message
- the message to logpublic void error(java.lang.Object message)
error
" status.message
- the message to logpublic void warning(java.lang.Object message)
warning
" status.message
- the message to logpublic void info(java.lang.Object message, java.lang.Throwable t)
info
" status.message
- the message to logpublic void debug(java.lang.Object message)
debug
" status.message
- the message to logpublic boolean isFatalEnabled()
fatal
messages.true
if enabled, and false
otherwisepublic boolean isDebugEnabled()
debug
messages.true
if enabled, and false
otherwisepublic boolean isInfoEnabled()
info
messages.true
if enabled, and false
otherwisepublic boolean isWarnEnabled()
warning
messages.true
if enabled, and false
otherwisepublic boolean isErrorEnabled()
error
messages.true
if enabled, and false
otherwise