Active Query Builder support area

How to turn the logging on? (WinForms and WPF Editions)

Last modified:


Assign an instance of this StreamLog class to the *.Logger.Log properties of the SqlContext, SyntaxProvider and MetadataProvider instances:

public void SetLogger()
{
    var log = new StreamLog(new FileStream(@"c:\tmp\Log", FileMode.Create, FileAccess.Write));
    queryBuilder1.SqlContext.Logger.Log = log;
    queryBuilder1.MetadataProvider.Logger.Log = log;
    queryBuilder1.SyntaxProvider.Logger.Log = log;
}

 

The StreamLog class is available out of the box, but if you need to integrate the AQB logging into existing logging system, such as log4net, you can create your class implementing the ILog interface using the following template. 

public class Log: ActiveQueryBuilder.Core.ILog
{
    public void Trace(string message)
    {
    }

    public void Warning(string message)
    {
    }

    public void Error(string message)
    {
    }

    public void Error(Exception ex, string message)
    {
    }
}

Is this article helpful for you?