Class Logger

java.lang.Object
com.enterprisedt.util.debug.Logger

public class Logger extends Object
Logger class that mimics log4j Logger class. If log4j integration is desired, the "edtftp.log4j" property should be set to "true" and log4j classes must be in the classpath
Version:
$Revision$
Author:
Bruce Blackshaw
  • Field Details

    • cvsId

      public static String cvsId
      Revision control id
  • Method Details

    • getLevel

      public static Level getLevel()
      Returns the logging level for all loggers.
      Returns:
      current logging level.
    • setLevel

      public static void setLevel(Level level)
      Set all loggers to this level
      Parameters:
      level - new level
    • getLogger

      public static Logger getLogger(Class clazz)
      Get a logger for the supplied class
      Parameters:
      clazz - full class name
      Returns:
      logger for class
    • getLogger

      public static Logger getLogger(String clazz)
      Get a logger for the supplied class
      Parameters:
      clazz - full class name
      Returns:
      logger for class
    • addAppender

      public static void addAppender(Appender newAppender)
      Add an appender to our list
      Parameters:
      newAppender -
    • addFileAppender

      public static void addFileAppender(String fileName) throws IOException
      Add a file-appender to our list
      Parameters:
      fileName - Path of file.
      Throws:
      IOException
    • addStandardOutputAppender

      public static void addStandardOutputAppender()
      Add a standard-output appender to our list.
    • removeAppender

      public static void removeAppender(Appender appender)
      Remove an appender to from list
      Parameters:
      appender -
    • clearAppenders

      public static void clearAppenders()
      Clear all appenders
    • shutdown

      public static void shutdown()
      Close all appenders
    • logThreadNames

      public static void logThreadNames(boolean logThreadNames)
      Set global flag for logging thread names as part of the logger names.
      Parameters:
      logThreadNames - true if logging thread names, false otherwise
    • logThreadName

      public void logThreadName(boolean logThreadName)
      Set flag for logging thread names as part of the logger names for this instance of the logger.
      Parameters:
      logThreadName - true if logging thread names, false otherwise
    • log

      public void log(Level level, String message, Throwable t)
      Log a message
      Parameters:
      level - log level
      message - message to log
      t - throwable object
    • info

      public void info(String message)
      Log an info level message
      Parameters:
      message - message to log
    • info

      public void info(String message, Throwable t)
      Log an info level message
      Parameters:
      message - message to log
      t - throwable object
    • warn

      public void warn(String message)
      Log a warning level message
      Parameters:
      message - message to log
    • warn

      public void warn(String message, Throwable t)
      Log a warning level message
      Parameters:
      message - message to log
      t - throwable object
    • error

      public void error(String message)
      Log an error level message
      Parameters:
      message - message to log
    • error

      public void error(String message, Throwable t)
      Log an error level message
      Parameters:
      message - message to log
      t - throwable object
    • fatal

      public void fatal(String message)
      Log a fatal level message
      Parameters:
      message - message to log
    • fatal

      public void fatal(String message, Throwable t)
      Log a fatal level message
      Parameters:
      message - message to log
      t - throwable object
    • debug

      public void debug(String message)
      Log a debug level message
      Parameters:
      message - message to log
    • debug

      public void debug(String message, byte[] data)
      Log a debug level message
      Parameters:
      message - message to log
    • debug

      public void debug(String message, Object arg)
      Logs by substituting in the argument at the location marked in the message argument by {0}. Additional MessageFormat formatting instructions may be included. Note that this method saves processing time by not building the complete string unless it is necessary; this saves the need for encapsulating many complete logging statements in an "if (log.isDebugEnabled())" block.
      Parameters:
      message - Message containing "substitution marks"
      arg - argument to be substituted at the marked location.
    • debug

      public void debug(String message, Object arg0, Object arg1)
      Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number). Additional MessageFormat formatting instructions may be included.Note that this method saves processing time by not building the complete string unless it is necessary; this saves the need for encapsulating many complete logging statements in an "if (log.isDebugEnabled())" block.
      Parameters:
      message - Message containing "substitution marks"
      arg0 - argument to be substituted at the marked location.
      arg1 - argument to be substituted at the marked location.
    • debug

      public void debug(String message, Object arg0, Object arg1, Object arg2)
      Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number). Additional MessageFormat formatting instructions may be included.Note that this method saves processing time by not building the complete string unless it is necessary; this saves the need for encapsulating many complete logging statements in an "if (log.isDebugEnabled())" block.
      Parameters:
      message - Message containing "substitution marks"
      arg0 - argument to be substituted at the marked location.
      arg1 - argument to be substituted at the marked location.
      arg2 - argument to be substituted at the marked location.
    • debug

      public void debug(String message, Object arg0, Object arg1, Object arg2, Object arg3)
      Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number). Additional MessageFormat formatting instructions may be included.Note that this method saves processing time by not building the complete string unless it is necessary; this saves the need for encapsulating many complete logging statements in an "if (log.isDebugEnabled())" block.
      Parameters:
      message - Message containing "substitution marks"
      arg0 - argument to be substituted at the marked location.
      arg1 - argument to be substituted at the marked location.
      arg2 - argument to be substituted at the marked location.
      arg3 - argument to be substituted at the marked location.
    • debug

      public void debug(String message, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
      Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number). Additional MessageFormat formatting instructions may be included.Note that this method saves processing time by not building the complete string unless it is necessary; this saves the need for encapsulating many complete logging statements in an "if (log.isDebugEnabled())" block.
      Parameters:
      message - Message containing "substitution marks"
      arg0 - argument to be substituted at the marked location.
      arg1 - argument to be substituted at the marked location.
      arg2 - argument to be substituted at the marked location.
      arg3 - argument to be substituted at the marked location.
      arg4 - argument to be substituted at the marked location.
    • debug

      public void debug(String message, Throwable t)
      Log a debug level message
      Parameters:
      message - message to log
      t - throwable object
    • isEnabledFor

      public boolean isEnabledFor(Level level)
      Is logging enabled for the supplied level?
      Parameters:
      level - level to test for
      Returns:
      true if enabled
    • isDebugEnabled

      public boolean isDebugEnabled()
      Is logging enabled for the supplied level?
      Returns:
      true if enabled
    • isInfoEnabled

      public boolean isInfoEnabled()
      Is logging enabled for the supplied level?
      Returns:
      true if enabled