Class Logger

java.lang.Object
com.isomorphic.log.Logger

public class Logger extends Object
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 unstable
  • warning--unusual data or a risky operation is about to be attempted
  • info--interesting events worth noting
  • debug--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 Summary

    Constructors
    Constructor
    Description
    Logger(Class objClass)
    Constructs Logger object using className of provided Class as logging category.
    Logger(String subsystem)
    Constructs Logger object using provided subsystem as logging category.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    debug(Object message)
    Logs a message with "debug" status.
    void
    error(Object message)
    Logs a message with "error" status.
    void
    fatal(Object message)
    Logs a message with "fatal" status.
    void
    info(Object message, Throwable t)
    Logs a message with "info" status.
    boolean
    Checks if the logger has been enabled to allow debug messages.
    boolean
    Checks if the logger has been enabled to allow error messages.
    boolean
    Checks if the logger has been enabled to allow fatal messages.
    boolean
    Checks if the logger has been enabled to allow info messages.
    boolean
    Checks if the logger has been enabled to allow warning messages.
    void
    warning(Object message)
    Logs a message with "warning" status.
  • Constructor Details

    • Logger

      public Logger(Class objClass)
      Constructs Logger object using className of provided Class as logging category.
    • Logger

      public Logger(String subsystem)
      Constructs Logger object using provided subsystem as logging category.
  • Method Details

    • fatal

      public void fatal(Object message)
      Logs a message with "fatal" status.
      Parameters:
      message - the message to log
    • error

      public void error(Object message)
      Logs a message with "error" status.
      Parameters:
      message - the message to log
    • warning

      public void warning(Object message)
      Logs a message with "warning" status.
      Parameters:
      message - the message to log
    • info

      public void info(Object message, Throwable t)
      Logs a message with "info" status.
      Parameters:
      message - the message to log
    • debug

      public void debug(Object message)
      Logs a message with "debug" status.
      Parameters:
      message - the message to log
    • isFatalEnabled

      public boolean isFatalEnabled()
      Checks if the logger has been enabled to allow fatal messages.
      Returns:
      true if enabled, and false otherwise
    • isDebugEnabled

      public boolean isDebugEnabled()
      Checks if the logger has been enabled to allow debug messages.
      Returns:
      true if enabled, and false otherwise
    • isInfoEnabled

      public boolean isInfoEnabled()
      Checks if the logger has been enabled to allow info messages.
      Returns:
      true if enabled, and false otherwise
    • isWarnEnabled

      public boolean isWarnEnabled()
      Checks if the logger has been enabled to allow warning messages.
      Returns:
      true if enabled, and false otherwise
    • isErrorEnabled

      public boolean isErrorEnabled()
      Checks if the logger has been enabled to allow error messages.
      Returns:
      true if enabled, and false otherwise