org.testng.log4testng
Class Logger

java.lang.Object  extended by org.testng.log4testng.Logger

public class Logger
extends Object

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:

  • All logging is done using System.out (for levels < ERROR) or System.err. There is no way to specify Appenders.
  • There is no way to control logging programmatically.
  • The log4testng.properties resource is searched in the classpath on the first call to the logging API. If it is not present, logging defaults to the WARN level.
The property file contains lines in the following format:
 # 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
 voiddebug(Object message)
          Log a message object with the DEBUG level.
 voiddebug(Object message, Throwable t)
          Log a message object with the DEBUG level including the stack trace of the Throwable t passed as parameter.
 voiderror(Object message)
          Log a message object with the ERROR level.
 voiderror(Object message, Throwable t)
          Log a message object with the DEBUG level including the stack trace of the Throwable t passed as parameter.
 voidfatal(Object message)
          Log a message object with the FATAL level.
 voidfatal(Object message, Throwable t)
          Log a message object with the FATAL level including the stack trace of the Throwable t passed as parameter.
static LoggergetLogger(Class pClass)
          Retrieve a logger named according to the value of the pClass.getName() parameter.
 voidinfo(Object message)
          Log a message object with the INFO level.
 voidinfo(Object message, Throwable t)
          Log a message object with the WARN level including the stack trace of the Throwable t passed as parameter.
 booleanisDebugEnabled()
          Check whether this logger is enabled for the DEBUG Level.
 booleanisInfoEnabled()
          Check whether this logger is enabled for the INFO Level.
 booleanisTraceEnabled()
          Check whether this logger is enabled for the TRACE Level.
static voidmain(String[] pArgs)
          Run all tests.
 voidtrace(Object message)
          Log a message object with the TRACE level.
 voidtrace(Object message, Throwable t)
          Log a message object with the TRACE level including the stack trace of the Throwable t passed as parameter.
 voidwarn(Object message)
          Log a message object with the WARN level.
 voidwarn(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

getLogger

public static Logger getLogger(Class pClass)
Retrieve a logger named according to the value of the pClass.getName() parameter. If the named logger already exists, then the existing instance will be returned. Otherwise, a new instance is created. By default, loggers do not have a set level but inherit it from their nearest ancestor with a set level.

Parameters:
pClass - The class' logger to retrieve.
Returns:
a logger named according to the value of the pClass.getName().

isTraceEnabled

public boolean isTraceEnabled()
Check whether this logger is enabled for the TRACE Level.

Returns:
true if this logger is enabled for level TRACE, false otherwise.

trace

public void trace(Object message)
Log a message object with the TRACE level. This method first checks if this logger is TRACE enabled. If this logger is TRACE enabled, then it converts the message object (passed as parameter) to a string by invoking toString(). WARNING Note that passing a Throwable to this method will print the name of the Throwable but no stack trace. To print a stack trace use the trace(Object, Throwable) form instead.

Parameters:
message - the message object to log.

trace

public 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. See Logger.trace(Object) form for more detailed information.

Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.

isDebugEnabled

public boolean isDebugEnabled()
Check whether this logger is enabled for the DEBUG Level.

Returns:
true if this logger is enabled for level DEBUG, false otherwise.

debug

public void debug(Object message)
Log a message object with the DEBUG level. See Logger.trace(Object) form for more detailed information.

Parameters:
message - the message object to log.

debug

public 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. See Logger.trace(Object, Throwable) form for more detailed information.

Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.

isInfoEnabled

public boolean isInfoEnabled()
Check whether this logger is enabled for the INFO Level.

Returns:
true if this logger is enabled for level INFO, false otherwise.

info

public void info(Object message)
Log a message object with the INFO level. See Logger.trace(Object) form for more detailed information.

Parameters:
message - the message object to log.

info

public 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. See Logger.trace(Object, Throwable) form for more detailed information.

Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.

warn

public void warn(Object message)
Log a message object with the WARN level. See Logger.trace(Object) form for more detailed information.

Parameters:
message - the message object to log.

warn

public 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. See Logger.trace(Object, Throwable) form for more detailed information.

Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.

error

public void error(Object message)
Log a message object with the ERROR level. See Logger.trace(Object) form for more detailed information.

Parameters:
message - the message object to log.

error

public 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. See Logger.trace(Object, Throwable) form for more detailed information.

Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.

fatal

public void fatal(Object message)
Log a message object with the FATAL level. See Logger.trace(Object) form for more detailed information.

Parameters:
message - the message object to log.

fatal

public 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. See Logger.trace(Object, Throwable) form for more detailed information.

Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.

main

public static void main(String[] pArgs)
Run all tests. (very crusty ...)

Parameters:
pArgs - not used


Copyright © 2012. All Rights Reserved.


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14