|
WebObjects 5.2.2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.webobjects.foundation.NSLog.Logger
|
+--com.webobjects.foundation.NSLog.Log4JLogger
NSLog.Log4JLogger is a concrete subclass of NSLog.Logger.
It logs output to an org.apache.log4j.Logger contained by this NSLog.Logger.
Thisorg.apache.log4j.Logger can be changed, which causes the receiver to direct log messages.
NOTE: allowedDebugLevel is significant for any NSLog.Log4JLogger, not just an instance assigned to NSLog.debug.
appendln(Object) requires a debug level internally to determine which public log method to use, because org.apache.log4j.Logger.forcedLog
is protected.
Make sure that you use the NSLog.Log4JLogger(int) constructor or manually invoke setAllowedDebugLevel on any new NSLog.Log4JLogger instance;
this instance may fail to log output until this happens.
Verbose logging produces output of the format: [Current Time] <Current Thread Name> output
#(int),
allowedDebugLevel(),
appendln(Object),
setAllowedDebugLevel(int),
NSLog,
NSLog.Logger,
NSLog.Logger.allowedDebugLevel()| Field Summary | |
static org.apache.log4j.Layout |
Log4JLoggerTerseFormat
An org.apache.log4j.Layout roughly equivalent to the lack of a prefix. |
static org.apache.log4j.Layout |
Log4JLoggerVerboseFormat
An org.apache.log4j.Layout roughly equivalent to the verbose prefix provided by NSLog.PrintStreamLogger. |
protected org.apache.log4j.Logger |
logger
|
| Fields inherited from class com.webobjects.foundation.NSLog.Logger |
debugLevel, isEnabled, isVerbose |
| Constructor Summary | |
NSLog.Log4JLogger(int aDebugLevel,
boolean isError)
Creates a new NSLog.Log4JLogger. |
|
NSLog.Log4JLogger(org.apache.log4j.Logger aLogger)
Creates a new NSLog.Log4JLogger which directs output to aLogger. |
|
| Method Summary | |
int |
allowedDebugLevel()
Invokes getLevel().toInt() on log4jLogger, and maps the result to the equivalent NSLog debug level. |
void |
appendln()
Invokes appendln(Object) with an empty string. |
void |
appendln(Object aValue)
Passes aValue as the Object parameter to the appropriate method of log4jLogger,
if isEnabled returns true. |
protected static int |
convertLog4JLevelToNSLogLevel(int aLog4JDebugLevel)
|
protected static int |
convertNSLogLevelToLog4JLevel(int anNSLogDebugLevel)
|
void |
flush()
Does nothing. |
org.apache.log4j.Logger |
log4jLogger()
Provides the org.apache.log4j.Logger wrapped by this NSLog.Log4JLogger instance. |
void |
setAllowedDebugLevel(int aDebugLevel)
Passes aDebugLevel to setLevel on log4jLogger. |
void |
setIsVerbose(boolean aBool)
Invokes setLayout and super.setIsVerbose(aBool). |
void |
setLayout(org.apache.log4j.Layout aLayout)
Sets the org.apache.log4j.Layout for all of the org.apache.log4j.Appenders of log4jLogger. |
void |
setLog4jLogger(org.apache.log4j.Logger aLogger)
Redirects output from this NSLog.Log4JLogger instance to aLogger. |
| Methods inherited from class com.webobjects.foundation.NSLog.Logger |
appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, isEnabled, isVerbose, setIsEnabled |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final org.apache.log4j.Layout Log4JLoggerTerseFormat
org.apache.log4j.Layout roughly equivalent to the lack of a prefix.
public static final org.apache.log4j.Layout Log4JLoggerVerboseFormat
org.apache.log4j.Layout roughly equivalent to the verbose prefix provided by NSLog.PrintStreamLogger.
protected org.apache.log4j.Logger logger
| Constructor Detail |
public NSLog.Log4JLogger(int aDebugLevel,
boolean isError)
log4jLogger will have one org.apache.log4j.ConsoleAppender which directs output to System.err or System.out,
depending upon the value of isError.
As the default value for isVerbose is true, as specified by NSLog.Logger(), the org.apache.log4j.ConsoleAppender
instance will use NSLog.Log4JLogger.Log4JLoggerVerboseFormat.
Passes aDebugLevel to setAllowedDebugLevel.
aDebugLevel - the debug level to use for this log4jLoggerisError - whether to direct output to System.err or System.out
IllegalArgumentException - if setAllowedDebugLevel fails#(org.apache.log4j.Logger aLogger),
Log4JLoggerVerboseFormat,
log4jLogger(),
setAllowedDebugLevel(int),
NSLog.Logger#()public NSLog.Log4JLogger(org.apache.log4j.Logger aLogger)
aLogger.
aLogger should be completely preconfigured.
No assumptions will be made about its configuration; consequently, this constructor invokes super.setIsVerbose(false).
IllegalArgumentException - if aLogger is null#(int),
log4jLogger(),
setIsVerbose(boolean),
NSLog.Logger#()| Method Detail |
public int allowedDebugLevel()
getLevel().toInt() on log4jLogger, and maps the result to the equivalent NSLog debug level.
This mapping is as follows:
| Log4J Debug Level | NSLog Debug Level |
null | DebugLevelOff |
org.apache.log4j.Level.OFF | DebugLevelOff |
org.apache.log4j.Level.ERROR | DebugLevelCritical |
org.apache.log4j.Level.FATAL | DebugLevelCritical |
org.apache.log4j.Level.INFO | DebugLevelInformational |
org.apache.log4j.Level.WARN | DebugLevelInformational |
org.apache.log4j.Level.ALL | DebugLevelDetailed |
org.apache.log4j.Level.DEBUG | DebugLevelDetailed |
allowedDebugLevel in class NSLog.LoggerIllegalArgumentException - if log4jLogger provides a value other than those specified in org.apache.log4j.Levellog4jLogger(),
setAllowedDebugLevel(int),
NSLog.Logger.allowedDebugLevel(),
NSLogpublic void appendln()
appendln(Object) with an empty string.
appendln in class NSLog.Loggerappendln(Object),
NSLog.Logger.appendln()public void appendln(Object aValue)
aValue as the Object parameter to the appropriate method of log4jLogger,
if isEnabled returns true.
appendln in class NSLog.LoggeraValue - the object to be loggedlog4jLogger(),
NSLog.Logger.appendln(Object),
NSLog.Logger.isEnabledprotected static int convertLog4JLevelToNSLogLevel(int aLog4JDebugLevel)
protected static int convertNSLogLevelToLog4JLevel(int anNSLogDebugLevel)
public void flush()
org.apache.log4j.Logger does not provide a mechanism to flush output on demand.
By default, org.apache.log4j.Logger does flush each fragment of output automatically.
flush in class NSLog.LoggerNSLog.Logger.flush()public org.apache.log4j.Logger log4jLogger()
org.apache.log4j.Logger wrapped by this NSLog.Log4JLogger instance.
The methods for this object use the org.apache.log4j.Logger instance directly, rather than via this accessor method.
org.apache.log4j.Logger; never null#(int),
#(org.apache.log4j.Logger),
setLog4jLogger(org.apache.log4j.Logger),
NSLog.Logger#()public void setAllowedDebugLevel(int aDebugLevel)
aDebugLevel to setLevel on log4jLogger.
aDebugLevel may be either an NSLog debug level or an integer level from org.apache.log4j.Level.
Maps an NSLog debug level to the equivalent org.apache.log4j.Level integer, or passes through a value from org.apache.log4j.Level.
This mapping is as follows:
| NSLog Debug Level | Log4J Debug Level |
DebugLevelOff | org.apache.log4j.Level.OFF |
DebugLevelCritical | org.apache.log4j.Level.ERROR |
DebugLevelInformational | org.apache.log4j.Level.INFO |
DebugLevelDetailed | org.apache.log4j.Level.ALL |
setAllowedDebugLevel in class NSLog.LoggeraDebugLevel - level of debug required
IllegalArgumentException - if aDebugLevel is not a valid level for NSLog or org.apache.log4j.LevelallowedDebugLevel(),
log4jLogger(),
NSLog.Logger.setAllowedDebugLevel(int),
NSLogpublic void setIsVerbose(boolean aBool)
setLayout and super.setIsVerbose(aBool).
If aBool is true, passes NSLog.Log4JLogger.Log4JLoggerVerboseFormat to setLayout.
Otherwise, passes NSLog.Log4JLogger.Log4JLoggerTerseFormat.
This method is synchronized to avoid a race condition.
NOTE: This method has side effects described above, which vary somewhat from those described in NSLog.Logger.setIsVerbose.
setIsVerbose in class NSLog.LoggeraBool - true if NSLog.Log4JLogger.Log4JLoggerVerboseFormat should be used;
false if NSLog.Log4JLogger.Log4JLoggerTerseFormat should be usedLog4JLoggerTerseFormat,
Log4JLoggerVerboseFormat,
setLayout(org.apache.log4j.Layout),
NSLog.Logger.isVerbosepublic void setLayout(org.apache.log4j.Layout aLayout)
org.apache.log4j.Layout for all of the org.apache.log4j.Appenders of log4jLogger.
This method synchronizes on log4jLogger to avoid a race condition.
No change is made if aLayout is null.
aLayout - an instance of org.apache.log4j.Layoutlog4jLogger()public void setLog4jLogger(org.apache.log4j.Logger aLogger)
aLogger.
No change is made if aLogger is null.
aLogger should be completely preconfigured.
No assumptions will be made about its configuration; consequently, this constructor invokes super.setIsVerbose(false).
This method synchronizes on this NSLog.Log4JLogger instance to avoid a race condition.
aLogger - an instance of org.apache.log4j.Logger#(org.apache.log4j.Logger),
log4jLogger()
|
Last updated Mon Oct 13 15:42:52 PDT 2003. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||