|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webobjects.foundation.NSLog.Logger
com.webobjects.foundation.NSLog.Log4JLogger
public static class 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.
NSLog.Log4JLogger.allowedDebugLevel()
,
NSLog.Log4JLogger.appendln(Object)
,
NSLog.Log4JLogger.setAllowedDebugLevel(int)
,
NSLog
,
NSLog.Logger
,
NSLog.Logger.allowedDebugLevel()
Field Summary | |
---|---|
protected org.apache.log4j.Logger |
logger
|
protected org.apache.log4j.Level |
logLevel
|
Fields inherited from class com.webobjects.foundation.NSLog.Logger |
---|
debugLevel, isEnabled, isVerbose |
Constructor Summary | |
---|---|
NSLog.Log4JLogger()
|
|
NSLog.Log4JLogger(org.apache.log4j.Logger aLogger,
int level)
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 |
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, setIsVerbose |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.log4j.Logger logger
protected org.apache.log4j.Level logLevel
Constructor Detail |
---|
public NSLog.Log4JLogger()
public NSLog.Log4JLogger(org.apache.log4j.Logger aLogger, int level)
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
NSLog.Log4JLogger.log4jLogger()
,
NSLog.Logger.setIsVerbose(boolean)
,
NSLog.Logger
Method Detail |
---|
protected static int convertLog4JLevelToNSLogLevel(int aLog4JDebugLevel)
protected static int convertNSLogLevelToLog4JLevel(int anNSLogDebugLevel)
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.Logger
IllegalArgumentException
- if log4jLogger
provides a value other than those specified in org.apache.log4j.Level
NSLog.Log4JLogger.log4jLogger()
,
NSLog.Log4JLogger.setAllowedDebugLevel(int)
,
NSLog.Logger.allowedDebugLevel()
,
NSLog
public void appendln()
appendln(Object)
with an empty string.
appendln
in class NSLog.Logger
NSLog.Log4JLogger.appendln(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.Logger
aValue
- the object to be loggedNSLog.Log4JLogger.log4jLogger()
,
NSLog.Logger.appendln(Object)
,
NSLog.Logger.isEnabled
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.Logger
NSLog.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
NSLog.Log4JLogger.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.Logger
aDebugLevel
- level of debug required
IllegalArgumentException
- if aDebugLevel
is not a valid level for NSLogNSLog.Log4JLogger.allowedDebugLevel()
,
NSLog.Log4JLogger.log4jLogger()
,
NSLog.Logger.setAllowedDebugLevel(int)
,
NSLog
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;.
aLogger
- an instance of org.apache.log4j.Logger
NSLog.Log4JLogger.log4jLogger()
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |