|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.testng.log4testng.Logger
public class Logger
TestNG support logging via a custom logging framework similar to Log4j. To control logging, add a resource named "log4testng.properties" to your classpath. The logging levels are TRACE, DEBUG, INFO, WARN, ERROR and FATAL. The Logging framework has the following characteristics:
# log4testng will log its own behavior (generally used for debugging this package only).
log4testng.debug=true
# Specifies the root Loggers logging level. Will log DEBUG level and above
log4testng.rootLogger=DEBUG
# The org.testng.reporters.EmailableReporter Logger will log TRACE level and above
log4testng.logger.org.testng.reporters.EmailableReporter=TRACE
# All Logger in packages below org.testng will log WARN level and above
log4testng.logger.org.testng=WARN
In your source files you will typically instantiate and use loggers this ways:
import org.testng.log4testng.Logger;
class ThisClass {
private static final Logger LOGGER = Logger.getLogger(ThisClass.class);
...
LOGGER.debug("entering myMethod()");
...
LOGGER.warn("unknown file: " + filename);
...
LOGGER.error("Unexpected error", exception);
Method Summary | |
---|---|
void |
debug(Object message)
Log a message object with the DEBUG level. |
void |
debug(Object message,
Throwable t)
Log a message object with the DEBUG level including the stack trace of the Throwable t passed as parameter. |
void |
error(Object message)
Log a message object with the ERROR level. |
void |
error(Object message,
Throwable t)
Log a message object with the DEBUG level including the stack trace of the Throwable t passed as parameter. |
void |
fatal(Object message)
Log a message object with the FATAL level. |
void |
fatal(Object message,
Throwable t)
Log a message object with the FATAL level including the stack trace of the Throwable t passed as parameter. |
static Logger |
getLogger(Class pClass)
Retrieve a logger named according to the value of the pClass.getName() parameter. |
void |
info(Object message)
Log a message object with the INFO level. |
void |
info(Object message,
Throwable t)
Log a message object with the WARN level including the stack trace of the Throwable t passed as parameter. |
boolean |
isDebugEnabled()
Check whether this logger is enabled for the DEBUG Level. |
boolean |
isInfoEnabled()
Check whether this logger is enabled for the INFO Level. |
boolean |
isTraceEnabled()
Check whether this logger is enabled for the TRACE Level. |
static void |
main(String[] pArgs)
Run all tests. |
void |
trace(Object message)
Log a message object with the TRACE level. |
void |
trace(Object message,
Throwable t)
Log a message object with the TRACE level including the stack trace of the Throwable t passed as parameter. |
void |
warn(Object message)
Log a message object with the WARN level. |
void |
warn(Object message,
Throwable t)
Log a message object with the ERROR level including the stack trace of the Throwable t passed as parameter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Logger getLogger(Class pClass)
pClass
- The class' logger to retrieve.
public boolean isTraceEnabled()
public void trace(Object message)
message
- the message object to log.public void trace(Object message, Throwable t)
message
- the message object to log.t
- the exception to log, including its stack trace.public boolean isDebugEnabled()
public void debug(Object message)
message
- the message object to log.public void debug(Object message, Throwable t)
message
- the message object to log.t
- the exception to log, including its stack trace.public boolean isInfoEnabled()
public void info(Object message)
message
- the message object to log.public void info(Object message, Throwable t)
message
- the message object to log.t
- the exception to log, including its stack trace.public void warn(Object message)
message
- the message object to log.public void warn(Object message, Throwable t)
message
- the message object to log.t
- the exception to log, including its stack trace.public void error(Object message)
message
- the message object to log.public void error(Object message, Throwable t)
message
- the message object to log.t
- the exception to log, including its stack trace.public void fatal(Object message)
message
- the message object to log.public void fatal(Object message, Throwable t)
message
- the message object to log.t
- the exception to log, including its stack trace.public static void main(String[] pArgs)
pArgs
- not used
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |