我在我的应用程序中使用Semantic Logging Out-Of-Process。我创建了一个eventsource类,如下所示
[EventSource(Name = "SemanticLoggingOutOfProcessEventSource")]
public class SampleEventSource : EventSource
{
public class Keywords
{
public const EventKeywords Page = (EventKeywords)1;
public const EventKeywords DataBase = (EventKeywords)2;
public const EventKeywords Diagnostic = (EventKeywords)4;
public const EventKeywords Perf = (EventKeywords)8;
}
public class Opcodes
{
public const EventOpcode Start = (EventOpcode)20;
public const EventOpcode Finish = (EventOpcode)21;
public const EventOpcode Error = (EventOpcode)22;
public const EventOpcode Starting = (EventOpcode)23;
public const EventOpcode QueryStart = (EventOpcode)24;
public const EventOpcode QueryFinish = (EventOpcode)25;
public const EventOpcode QueryNoResults = (EventOpcode)26;
public const EventOpcode CacheQuery = (EventOpcode)27;
public const EventOpcode CacheUpdate = (EventOpcode)28;
public const EventOpcode CacheHit = (EventOpcode)29;
public const EventOpcode CacheMiss = (EventOpcode)30;
}
public class Tasks
{
public const EventTask Page = (EventTask)1;
public const EventTask DBQuery = (EventTask)2;
public const EventTask Application = (EventTask)3;
}
[Event(1, Message = "Method1 Starting.", Opcode = Opcodes.Starting, Task = Tasks.DBQuery, Level = EventLevel.Informational, Keywords = Keywords.Perf)]
public void Method1Starting() { if (this.IsEnabled()) this.WriteEvent(1); }
[Event(2, Message = "Method1 Ending.", Opcode = Opcodes.Finish, Task = Tasks.DBQuery, Level = EventLevel.Informational, Keywords = Keywords.Perf)]
public void Method1Ending() { if (this.IsEnabled()) this.WriteEvent(2); }
[Event(3, Message = "Method2 Starting.", Opcode = Opcodes.Starting, Task = Tasks.DBQuery, Level = EventLevel.Informational, Keywords = Keywords.Perf)]
public void Method2Starting() { if (this.IsEnabled()) this.WriteEvent(3); }
[Event(4, Message = "Method2 Ending.", Opcode = Opcodes.Finish, Task = Tasks.DBQuery, Level = EventLevel.Informational, Keywords = Keywords.Perf)]
public void Method2Ending() { if (this.IsEnabled()) this.WriteEvent(4); }
public static readonly SampleEventSource outOfProcessLog = new SampleEventSource();
}
我在packages \ EnterpriseLibrary.SemanticLogging.Service.2.0.1406.1 \ tools \ SemanticLogging-svc.xml中设置了eventsource名称。我启动了语义服务并运行了应用程序。该日志被写入" packages \ EnterpriseLibrary.SemanticLogging.Service.2.0.1406.1 \ tools \ SemanticLogging-svc.runtime.log"文件。我有以下问题: