It is possible to only include log messages when certain criteria are met.
StringBuilderTarget target = new StringBuilderTarget();
Log.Config.Targets.Add(target);
//Only log for the namespace AcmeCorp.BusinessLogic
target.NamespaceFilter = "AcmeCorp.BusinessLogic*";
//Only log for the specified assembly name
target.AssemblyNameFilter = "AcmeCorp.InvoiceSystem";
//Only log for the specified class name
target.ClassNameFilter = "ShippingLogic";
//Only log for the specified method name
target.MethodNameFilter = "CalculateGroundShipping";
//Only log for the specified thread name
string threadName = System.Threading.Thread.CurrentThread.Name;
if (string.IsNullOrEmpty(threadName))
{
threadName = System.Threading.Thread.CurrentThread.ManagedThreadId.ToString();
}
target.ThreadNameFilter = threadName;
//Only log for the specified user name
target.UserNameFilter = "jsmith";
//Only log for the specified machine name
target.MachineNameFilter = "WebServer1";