Package com.enterprisedt.util.debug
Class Logger
java.lang.Object
com.enterprisedt.util.debug.Logger
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAppender(Appender newAppender) Add an appender to our liststatic voidaddFileAppender(String fileName) Add a file-appender to our liststatic voidAdd a standard-output appender to our list.static voidClear all appendersvoidLog a debug level messagevoidLog a debug level messagevoidLogs by substituting in the argument at the location marked in the message argument by {0}.voidLogs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).voidLogs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).voidLogs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).voidLogs by substituting in the arguments at the locations marked in the message argument by {#} (where # is a number).voidLog a debug level messagevoidLog an error level messagevoidLog an error level messagevoidLog a fatal level messagevoidLog a fatal level messagestatic LevelgetLevel()Returns the logging level for all loggers.static LoggerGet a logger for the supplied classstatic LoggerGet a logger for the supplied classvoidLog an info level messagevoidLog an info level messagebooleanIs logging enabled for the supplied level?booleanisEnabledFor(Level level) Is logging enabled for the supplied level?booleanIs logging enabled for the supplied level?voidLog a messagevoidlogThreadName(boolean logThreadName) Set flag for logging thread names as part of the logger names for this instance of the logger.static voidlogThreadNames(boolean logThreadNames) Set global flag for logging thread names as part of the logger names.static voidremoveAppender(Appender appender) Remove an appender to from liststatic voidSet all loggers to this levelstatic voidshutdown()Close all appendersvoidLog a warning level messagevoidLog a warning level message
-
Field Details
-
cvsId
Revision control id
-
-
Method Details
-
getLevel
Returns the logging level for all loggers.- Returns:
- current logging level.
-
setLevel
Set all loggers to this level- Parameters:
level- new level
-
getLogger
Get a logger for the supplied class- Parameters:
clazz- full class name- Returns:
- logger for class
-
getLogger
Get a logger for the supplied class- Parameters:
clazz- full class name- Returns:
- logger for class
-
addAppender
Add an appender to our list- Parameters:
newAppender-
-
addFileAppender
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
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
Log a message- Parameters:
level- log levelmessage- message to logt- throwable object
-
info
Log an info level message- Parameters:
message- message to log
-
info
Log an info level message- Parameters:
message- message to logt- throwable object
-
warn
Log a warning level message- Parameters:
message- message to log
-
warn
Log a warning level message- Parameters:
message- message to logt- throwable object
-
error
Log an error level message- Parameters:
message- message to log
-
error
Log an error level message- Parameters:
message- message to logt- throwable object
-
fatal
Log a fatal level message- Parameters:
message- message to log
-
fatal
Log a fatal level message- Parameters:
message- message to logt- throwable object
-
debug
Log a debug level message- Parameters:
message- message to log
-
debug
Log a debug level message- Parameters:
message- message to log
-
debug
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
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
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
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
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
Log a debug level message- Parameters:
message- message to logt- throwable object
-
isEnabledFor
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
-