|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.aglets.log.log4j.Log4jCategory
Wrapper class for log4j implementation of logging category.
Constructor Summary | |
Log4jCategory(java.lang.String name)
|
Method Summary | |
void |
debug(java.lang.Object msg)
Logs a message at debug priority. |
void |
error(java.lang.Object msg)
Logs a message at error priority. |
void |
error(java.lang.Object msg,
java.lang.Exception exc)
Logs a message at error priority and passes an exception for logging. |
void |
fatal(java.lang.Object msg)
Logs a message at Fatal priority. |
void |
info(java.lang.Object msg)
Logs a mesasge at info priority. |
boolean |
isDebugEnabled()
Check whether this category is enabled for the DEBUG
priority. |
void |
warn(java.lang.Object msg)
Logs a message at warn priority. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Log4jCategory(java.lang.String name)
Method Detail |
public void fatal(java.lang.Object msg)
fatal
in interface LogCategory
org.aglets.log.LogCategory
msg
- Message to be logged.public void error(java.lang.Object msg)
error
in interface LogCategory
msg
- Message to be logged.public void error(java.lang.Object msg, java.lang.Exception exc)
error
in interface LogCategory
msg
- Message to be logged.exc
- Description of Parameterpublic void warn(java.lang.Object msg)
warn
in interface LogCategory
msg
- Message to be logged.public void info(java.lang.Object msg)
info
in interface LogCategory
msg
- Message to be logged.public void debug(java.lang.Object msg)
debug
in interface LogCategory
msg
- Message to be logged.public boolean isDebugEnabled()
DEBUG
priority.
This function is intended to lessen the computational cost of disabled log debug statements.
For some cat
Category object, when you write,
cat.debug("This is entry number: " + i );
You incur the cost constructing the message, concatenatiion in this case, regardless of whether the message is logged or not.
If you are worried about speed, then you should write
if(cat.isDebugEnabled()) { cat.debug("This is entry number: " + i ); }
This way you will not incur the cost of parameter
construction if debugging is disabled for cat
. On
the other hand, if the cat
is debug enabled, you
will incur the cost of evaluating whether the category is debug
enabled twice. Once in isDebugEnabled
and once in
the debug
. This is an insignificant overhead
since evaluating a category takes about 1%% of the time it
takes to actually log.
isDebugEnabled
in interface LogCategory
true
if this category is debug
enabled, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |