Class SimpleLog
- All Implemented Interfaces:
org.apache.commons.logging.Log
Simple implementation of Log that sends all enabled log messages, for all defined loggers, to System.err.
Hacked from commons-logging SimpleLog for use in discovery. This is intended to be enough of a Log implementation to bootstrap Discovery.
One property: org.apache.commons.discovery.log.level.
valid values: all, trace, debug, info, warn, error, fatal, off.
- Version:
- $Id: SimpleLog.java 1089489 2011-04-06 15:20:24Z sebb $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static DateFormatDeprecated.Used to format timesstatic final intDeprecated.Enable all logging levelsstatic final intDeprecated."Debug" level logging.static final intDeprecated."Error" level logging.static final intDeprecated."Fatal" level logging.static final intDeprecated."Info" level logging.static final intDeprecated.Enable no logging levelsstatic final intDeprecated."Trace" level logging.static final intDeprecated."Warn" level logging.protected static intDeprecated.The current log levelprotected StringDeprecated.The name of this simple log instanceprivate static PrintStreamDeprecated.Use 'out' instead of 'err' for logging to keep in-sync with test messages.private StringDeprecated.protected static final StringDeprecated.protected static booleanDeprecated.Include the current time in the log messageprotected static booleanDeprecated.Include the instance name in the log message?protected static booleanDeprecated.Include the short name ( last component ) of the logger in the log message. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidDeprecated.Log a message with debug log level.final voidDeprecated.Log an error with debug log level.final voidDeprecated.Log a message with error log level.final voidDeprecated.Log an error with error log level.final voidDeprecated.Log a message with fatal log level.final voidDeprecated.Log an error with fatal log level.static intgetLevel()Deprecated.Get logging level.final voidDeprecated.Log a message with info log level.final voidDeprecated.Log an error with info log level.final booleanDeprecated.Are debug messages currently enabled?final booleanDeprecated.Are error messages currently enabled?final booleanDeprecated.Are fatal messages currently enabled?final booleanDeprecated.Are info messages currently enabled?protected static booleanisLevelEnabled(int level) Deprecated.Is the given log level currently enabled?final booleanDeprecated.Are trace messages currently enabled?final booleanDeprecated.Are warn messages currently enabled?protected voidDeprecated.Do the actual logging.static voidsetLevel(int currentLogLevel) Deprecated.Set logging level.final voidDeprecated.Log a message with debug log level.final voidDeprecated.Log an error with debug log level.final voidDeprecated.Log a message with warn log level.final voidDeprecated.Log an error with warn log level.
-
Field Details
-
LOG_LEVEL_TRACE
public static final int LOG_LEVEL_TRACEDeprecated."Trace" level logging.- See Also:
-
LOG_LEVEL_DEBUG
public static final int LOG_LEVEL_DEBUGDeprecated."Debug" level logging.- See Also:
-
LOG_LEVEL_INFO
public static final int LOG_LEVEL_INFODeprecated."Info" level logging.- See Also:
-
LOG_LEVEL_WARN
public static final int LOG_LEVEL_WARNDeprecated."Warn" level logging.- See Also:
-
LOG_LEVEL_ERROR
public static final int LOG_LEVEL_ERRORDeprecated."Error" level logging.- See Also:
-
LOG_LEVEL_FATAL
public static final int LOG_LEVEL_FATALDeprecated."Fatal" level logging.- See Also:
-
LOG_LEVEL_ALL
public static final int LOG_LEVEL_ALLDeprecated.Enable all logging levels- See Also:
-
LOG_LEVEL_OFF
public static final int LOG_LEVEL_OFFDeprecated.Enable no logging levels- See Also:
-
PROP_LEVEL
Deprecated.- See Also:
-
showLogName
protected static boolean showLogNameDeprecated.Include the instance name in the log message? -
showShortName
protected static boolean showShortNameDeprecated.Include the short name ( last component ) of the logger in the log message. Default to true - otherwise we'll be lost in a flood of messages without knowing who sends them. -
showDateTime
protected static boolean showDateTimeDeprecated.Include the current time in the log message -
dateFormatter
Deprecated.Used to format times -
logLevel
protected static int logLevelDeprecated.The current log level -
out
Deprecated.Use 'out' instead of 'err' for logging to keep in-sync with test messages. -
logName
Deprecated.The name of this simple log instance -
prefix
Deprecated.
-
-
Constructor Details
-
SimpleLog
Deprecated.Construct a simple log with given name.- Parameters:
name- log name
-
-
Method Details
-
setLevel
public static void setLevel(int currentLogLevel) Deprecated.Set logging level.
- Parameters:
currentLogLevel- new logging level
-
getLevel
public static int getLevel()Deprecated.Get logging level.- Returns:
- The logging level
-
isLevelEnabled
protected static boolean isLevelEnabled(int level) Deprecated.Is the given log level currently enabled?- Parameters:
level- is this level enabled?- Returns:
- true, if the input level is enabled, false otherwise
-
log
Deprecated.Do the actual logging. This method assembles the message and then prints toSystem.err.- Parameters:
type- The logging levelmessage- The message to logt- The error cause, if any
-
debug
Deprecated.Log a message with debug log level.- Specified by:
debugin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to log
-
debug
Deprecated.Log an error with debug log level.- Specified by:
debugin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to logt- The error cause, if any
-
trace
Deprecated.Log a message with debug log level.- Specified by:
tracein interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to log
-
trace
Deprecated.Log an error with debug log level.- Specified by:
tracein interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to logt- The error cause, if any
-
info
Deprecated.Log a message with info log level.- Specified by:
infoin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to log
-
info
Deprecated.Log an error with info log level.- Specified by:
infoin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to logt- The error cause, if any
-
warn
Deprecated.Log a message with warn log level.- Specified by:
warnin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to log
-
warn
Deprecated.Log an error with warn log level.- Specified by:
warnin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to logt- The error cause, if any
-
error
Deprecated.Log a message with error log level.- Specified by:
errorin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to log
-
error
Deprecated.Log an error with error log level.- Specified by:
errorin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to logt- The error cause, if any
-
fatal
Deprecated.Log a message with fatal log level.- Specified by:
fatalin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to log
-
fatal
Deprecated.Log an error with fatal log level.- Specified by:
fatalin interfaceorg.apache.commons.logging.Log- Parameters:
message- The message to logt- The error cause, if any
-
isDebugEnabled
public final boolean isDebugEnabled()Deprecated.Are debug messages currently enabled?
This allows expensive operations such as
Stringconcatenation to be avoided when the message will be ignored by the logger.- Specified by:
isDebugEnabledin interfaceorg.apache.commons.logging.Log- Returns:
- true, if the
LOG_LEVEL_DEBUGis enabled, false otherwise
-
isErrorEnabled
public final boolean isErrorEnabled()Deprecated.Are error messages currently enabled?
This allows expensive operations such as
Stringconcatenation to be avoided when the message will be ignored by the logger.- Specified by:
isErrorEnabledin interfaceorg.apache.commons.logging.Log- Returns:
- true, if the
LOG_LEVEL_ERRORis enabled, false otherwise
-
isFatalEnabled
public final boolean isFatalEnabled()Deprecated.Are fatal messages currently enabled?
This allows expensive operations such as
Stringconcatenation to be avoided when the message will be ignored by the logger.- Specified by:
isFatalEnabledin interfaceorg.apache.commons.logging.Log- Returns:
- true, if the
LOG_LEVEL_FATALis enabled, false otherwise
-
isInfoEnabled
public final boolean isInfoEnabled()Deprecated.Are info messages currently enabled?
This allows expensive operations such as
Stringconcatenation to be avoided when the message will be ignored by the logger.- Specified by:
isInfoEnabledin interfaceorg.apache.commons.logging.Log- Returns:
- true, if the
LOG_LEVEL_INFOis enabled, false otherwise
-
isTraceEnabled
public final boolean isTraceEnabled()Deprecated.Are trace messages currently enabled?
This allows expensive operations such as
Stringconcatenation to be avoided when the message will be ignored by the logger.- Specified by:
isTraceEnabledin interfaceorg.apache.commons.logging.Log- Returns:
- true, if the
LOG_LEVEL_TRACEis enabled, false otherwise
-
isWarnEnabled
public final boolean isWarnEnabled()Deprecated.Are warn messages currently enabled?
This allows expensive operations such as
Stringconcatenation to be avoided when the message will be ignored by the logger.- Specified by:
isWarnEnabledin interfaceorg.apache.commons.logging.Log- Returns:
- true, if the
LOG_LEVEL_WARNis enabled, false otherwise
-