Right, Log4J is very easy to use. What you need is to put the log4j
configuration file in class path, then in your class use Log.getFactory() to
get the log handler.

For example,

public class Test1 {
  private static Log log = LogFactory.getLog(Test1.class);

  public void log(){
     log.info("Hello");
  }
}

You don't even need to add the Log.getFactory() to the base class
constructor, but simply
use the getLog(classname) in each class. In this way, you log message will
include the
actual class names, not the base class name.

Thanks,

Jian

On Mon, Oct 12, 2009 at 12:53 PM, Harihara Vinayakaram <[email protected]>wrote:

> Thanks. For now I have defined 2 base classes one extending TestMGTestCase
> and other extending DslContext and I have put the Log.getFactory() in the
> constructor .
>
> I have extended all other classes from these and I have added the log4j.jar
> and configured Apache Commons Logging to use log4j
>
>
> Regards
> Hari
>
> PS: Reporter.log is useful but that comes in the test results. (html file).
> I wanted a more traditional log for the tests
>
>
> On Mon, Oct 12, 2009 at 9:50 PM, Haroon Rasheed <[email protected]>wrote:
>
>> I dont know about the log4j but I have seen people using Reporter.log to
>> log the test steps in TestNG report.
>> Cheers
>> Haroon
>>
>> 2009/10/11 Harihara Vinayakaram <[email protected]>
>>
>> Hi
>>>   I am running Tellurium with TestNG .. I managed to have a base test
>>> class which I have configured for the log4j. But I would like to have logs
>>> in the modules too . What is best way to have logging set up for the modules
>>> too ?
>>>
>>> Regards
>>> Hari
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to