code sample of out-of-process

Topics: Using
Aug 11, 2014 at 11:57 AM
Edited Aug 11, 2014 at 11:58 AM
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:
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>

  <sinks>
    <rollingFlatFileSink name="MyEventSourceSink"
    fileName="RollingFlatFile.log"
    timeStampPattern="yyyy"
    rollInterval="Day">
      <sources>
        <eventSource name="MyEventSource" level="LogAlways"/>
      </sources>
      <eventTextFormatter header="+=========================================+"/>
    </rollingFlatFileSink>

  </sinks>
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);