edtFTPj/Free - Open-source FTP library for Java | Download


com.enterprisedt.util.debug
Class Logger

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

public class Logger
extends java.lang.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: 1.29 $
Author:
Bruce Blackshaw

Field Summary
static java.lang.String cvsId
          Revision control id
 
Method Summary
static void addAppender(Appender newAppender)
          Add an appender to our list
static void addFileAppender(java.lang.String fileName)
          Add a file-appender to our list
static void addStandardOutputAppender()
          Add a standard-output appender to our list.
static void clearAppenders()
          Clear all appenders
 void debug(java.lang.String message)
          Log a debug level message
 void debug(java.lang.String message, byte[] data)
          Log a debug level message
 void debug(java.lang.String message, java.lang.Object arg)
          Logs by substituting in the argument at the location marked in the message argument by {0}.
 void debug(java.lang.String message, java.lang.Object arg0, java.lang.Object arg1)
          Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).
 void debug(java.lang.String message, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
          Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).
 void debug(java.lang.String message, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).
 void debug(java.lang.String message, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
          Logs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).
 void debug(java.lang.String message, java.lang.Throwable t)
          Log a debug level message
 void error(java.lang.String message)
          Log an error level message
 void error(java.lang.String message, java.lang.Throwable t)
          Log an error level message
 void fatal(java.lang.String message)
          Log a fatal level message
 void fatal(java.lang.String message, java.lang.Throwable t)
          Log a fatal level message
static Level getLevel()
          Returns the logging level for all loggers.
static Logger getLogger(java.lang.Class clazz)
          Get a logger for the supplied class
static Logger getLogger(java.lang.String clazz)
          Get a logger for the supplied class
 void info(java.lang.String message)
          Log an info level message
 void info(java.lang.String message, java.lang.Throwable t)
          Log an info level message
 boolean isDebugEnabled()
          Is logging enabled for the supplied level?
 boolean isEnabledFor(Level level)
          Is logging enabled for the supplied level?
 boolean isInfoEnabled()
          Is logging enabled for the supplied level?
 void log(Level level, java.lang.String message, java.lang.Throwable t)
          Log a message
 void logThreadName(boolean logThreadName)
          Set flag for logging thread names as part of the logger names for this instance of the logger.
static void logThreadNames(boolean logThreadNames)
          Set global flag for logging thread names as part of the logger names.
static void removeAppender(Appender appender)
          Remove an appender to from list
static void setLevel(Level level)
          Set all loggers to this level
static void shutdown()
          Close all appenders
 void warn(java.lang.String message)
          Log a warning level message
 void warn(java.lang.String message, java.lang.Throwable t)
          Log a warning level message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cvsId

public static java.lang.String cvsId
Revision control id

Method Detail

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(java.lang.Class clazz)
Get a logger for the supplied class

Parameters:
clazz - full class name
Returns:
logger for class

getLogger

public static Logger getLogger(java.lang.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(java.lang.String fileName)
                            throws java.io.IOException
Add a file-appender to our list

Parameters:
fileName - Path of file.
Throws:
java.io.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,
                java.lang.String message,
                java.lang.Throwable t)
Log a message

Parameters:
level - log level
message - message to log
t - throwable object

info

public void info(java.lang.String message)
Log an info level message

Parameters:
message - message to log

info

public void info(java.lang.String message,
                 java.lang.Throwable t)
Log an info level message

Parameters:
message - message to log
t - throwable object

warn

public void warn(java.lang.String message)
Log a warning level message

Parameters:
message - message to log

warn

public void warn(java.lang.String message,
                 java.lang.Throwable t)
Log a warning level message

Parameters:
message - message to log
t - throwable object

error

public void error(java.lang.String message)
Log an error level message

Parameters:
message - message to log

error

public void error(java.lang.String message,
                  java.lang.Throwable t)
Log an error level message

Parameters:
message - message to log
t - throwable object

fatal

public void fatal(java.lang.String message)
Log a fatal level message

Parameters:
message - message to log

fatal

public void fatal(java.lang.String message,
                  java.lang.Throwable t)
Log a fatal level message

Parameters:
message - message to log
t - throwable object

debug

public void debug(java.lang.String message)
Log a debug level message

Parameters:
message - message to log

debug

public void debug(java.lang.String message,
                  byte[] data)
Log a debug level message

Parameters:
message - message to log

debug

public void debug(java.lang.String message,
                  java.lang.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(java.lang.String message,
                  java.lang.Object arg0,
                  java.lang.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(java.lang.String message,
                  java.lang.Object arg0,
                  java.lang.Object arg1,
                  java.lang.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(java.lang.String message,
                  java.lang.Object arg0,
                  java.lang.Object arg1,
                  java.lang.Object arg2,
                  java.lang.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(java.lang.String message,
                  java.lang.Object arg0,
                  java.lang.Object arg1,
                  java.lang.Object arg2,
                  java.lang.Object arg3,
                  java.lang.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(java.lang.String message,
                  java.lang.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


Copyright (c) 2001-2007 Enterprise Distributed Technologies Ltd. All Rights Reserved.