Beispiel #1
0
        public void DoWork()
        {
            var source = new ExtendedTraceSource("ServerComponent");
            try
            {

                using (var lScope = new LogicalOperationScope(source, "Process C"))
                {

                    var sample2 = new MyServerComponent(source);

                    sample2.TraceEvent(TraceEventType.Information, 10, "Server Message for the Process");

                }

                Trace.WriteLine("Hi");
                Console.WriteLine("HIII");
            }
            catch (Exception ex)
            {
                source.TraceEvent(TraceEventType.Error, 11, ex.ToString());
                Trace.WriteLine(ex.ToString());
                Console.WriteLine(ex.ToString());
            }
            finally {
                source.Close();
            }
        }
Beispiel #2
0
        public void DoWork()
        {
            var source = new ExtendedTraceSource("ServerComponent");

            try
            {
                using (var lScope = new LogicalOperationScope(source, "Process C"))
                {
                    var sample2 = new MyServerComponent(source);

                    sample2.TraceEvent(TraceEventType.Information, 10, "Server Message for the Process");
                }

                Trace.WriteLine("Hi");
                Console.WriteLine("HIII");
            }
            catch (Exception ex)
            {
                source.TraceEvent(TraceEventType.Error, 11, ex.ToString());
                Trace.WriteLine(ex.ToString());
                Console.WriteLine(ex.ToString());
            }
            finally {
                source.Close();
            }
        }