Can't set BizUnit instance logger?

Nov 7, 2008 at 12:04 AM
If I create a custom class that implements ILogWritter, I can use it as the writer for a Context object's logger by using the Context constructor that takes an ILogWritter instance. However, it appears that there's no way to set the logger instance of a BizUnit object - the BizUnit object will always use the default Logger constructor that uses ConsoleWritter.

Is this by design?
Mar 24, 2009 at 12:00 PM
Hi,
I think this is a bug. Kevin can confirm.

Basically, in the Init method of the BizUnit class , we can see the following code

private void Init(
            XmlDocument testConfig, TestGroupPhase phase, Context ctx)
        {
            if (null != ctx)
            {
                this.context = ctx;
                this.context.Initialize(this);
            }
            else
            {
                this.context = new Context(this);
                this.logger = this.context.Logger;
            }

            this.testGroupPhase = phase;

IMO, we should move the "this.logger = this.context.Logger;" line out of the else because if the context will always have a logger (either the basicLogger or the injected logger) .
If you have the source code, you can make this fix till it is fixed in the main code base

HTH,
Benjy

Coordinator
Jul 8, 2009 at 8:31 PM

Hi,

This was a bug, it should be fixed in the latest version,

thanks,

Kevin