|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.tools.util.JavaLogger
/** A SAND Logger implementation that wraps the standard JDK Logger as obtained from the environment.
| Field Summary | |
protected java.util.logging.Logger |
jdkLogger
The JDK Logger we are wrapping. |
protected int |
logLevel
The current SAND log level. |
protected java.lang.String |
sourceID
An identifying sourceID used for log output. |
| Fields inherited from interface org.sandev.basics.nodecommon.Logger |
LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_FATAL, LOGLEVEL_INFO, LOGLEVEL_STR_DEBUG, LOGLEVEL_STR_ERROR, LOGLEVEL_STR_FATAL, LOGLEVEL_STR_INFO, LOGLEVEL_STR_WARN, LOGLEVEL_STRINGS, LOGLEVEL_WARN |
| Constructor Summary | |
JavaLogger()
Default ctor does nothing. |
|
| Method Summary | |
java.util.logging.Logger |
getJDKLogger()
Return the JDK logger |
int |
getLogLevel()
Return the log level. |
java.lang.String |
getSourceID()
Return the instanceName |
void |
init(java.lang.String instanceName)
Initialize our native logger using the specified instance name |
void |
log(int severity,
java.lang.String msg)
Implementation of the required log method. |
void |
setLogLevel(int logLevel)
Set the log level. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int logLevel
protected java.lang.String sourceID
protected java.util.logging.Logger jdkLogger
| Constructor Detail |
public JavaLogger()
| Method Detail |
public void setLogLevel(int logLevel)
setLogLevel in interface org.sandev.basics.nodecommon.Loggerpublic int getLogLevel()
getLogLevel in interface org.sandev.basics.nodecommon.Loggerpublic java.lang.String getSourceID()
public java.util.logging.Logger getJDKLogger()
public void init(java.lang.String instanceName)
throws org.sandev.basics.nodecommon.LoggerException
init in interface org.sandev.basics.nodecommon.Loggerorg.sandev.basics.nodecommon.LoggerException
public void log(int severity,
java.lang.String msg)
throws org.sandev.basics.nodecommon.LoggerException
SAND log levels map to JDK log levels as:
LOGLEVEL_DEBUG is mapped to info rather than fine because fine output typically requires enabling trace output in the container which is a prohibitive flood of log info. There is no differentiation between LOGLEVEL_ERROR and LOGLEVEL_FATAL in the standard java.util.logging.Level so these both map to severe.
We call the precise (logp) methods using the logger
instance identifier as the class name and the SAND severity level
as the method name. This is because the logger printing the full
class name and best guess of the method name is unnecessarily
verbose and potentially innacurate.
Note that there are two filtering mechanisms at work when the application is running:
log in interface org.sandev.basics.nodecommon.Loggerorg.sandev.basics.nodecommon.LoggerException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||