This project is read-only.

code sample of out-of-process

Topics: Using
Aug 11, 2014 at 12:57 PM
Edited Aug 11, 2014 at 12:58 PM
Hi, can a proper code sample of out-of-process be provided in the dev guide or as separate file?

My problem is the out-of-process compiled and run fine, but no log file created.
According to the pdf/doc, config file should be created under the host app, which i did.
The current code sample provided, didn't include a config file, further more they can't be build, as some of the interfaces like IFormatterElement and ISinkElement are not found, also the namespace of .Etw seems to have changes, or the code expecting a separate .Etw.DLL

below is my App.config for the out-of-process host (console) app, which also the test app:
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

    <rollingFlatFileSink name="MyEventSourceSink"
        <eventSource name="MyEventSource" level="LogAlways"/>
      <eventTextFormatter header="+=========================================+"/>

the testing code:
    class Program
        static void Main(string[] args)
            var logger = SLog.MyEventSource.MyLogger;

            var el = new ObservableEventListener();
            var b1 = el.EnableEvents("MyEventSource", System.Diagnostics.Tracing.EventLevel.LogAlways, System.Diagnostics.Tracing.EventKeywords.None);
            logger.Log01("test test");
my logger code:
    [EventSource(Name = "MyEventSource")]
    public class MyEventSource : EventSource
        public class Keywords
            public const EventKeywords Keyword1 = (EventKeywords)1;

        [Event(1, Message = "my semantic logging : {0}", Level = EventLevel.Informational, Keywords = Keywords.Keyword1)]
        public void Log01(string txt)
            if (!this.IsEnabled()) return;
            this.WriteEvent(1, txt);