internal LegacyDiagnosticTrace(TraceSourceKind sourceType, string traceSourceName, string eventSourceName)
            : base(traceSourceName)
        {
            this.traceSourceType = sourceType;
            this.EventSourceName = eventSourceName;

            try
            {
                this.CreateTraceSource();
                this.AddDomainEventHandlersForCleanup();
            }
#if !NO_CONFIGURATION
            catch (ConfigurationErrorsException)
            {
                throw;
            }
#endif
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }
                System.Runtime.Diagnostics.EventLogger logger = new System.Runtime.Diagnostics.EventLogger(this.EventSourceName, null);
                logger.LogEvent(TraceEventType.Error, (ushort)System.Runtime.Diagnostics.EventLogCategory.Tracing, (uint)System.Runtime.Diagnostics.EventLogEventId.FailedToSetupTracing, false,
                    e.ToString());
            }
        }
        internal LegacyDiagnosticTrace(TraceSourceKind sourceType, string traceSourceName, string eventSourceName)
            : base(traceSourceName)
        {
            this.traceSourceType = sourceType;
            this.EventSourceName = eventSourceName;

            try
            {
                this.CreateTraceSource();
                this.AddDomainEventHandlersForCleanup();
            }
            catch (ConfigurationErrorsException)
            {
                throw;
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }
                System.Runtime.Diagnostics.EventLogger logger = new System.Runtime.Diagnostics.EventLogger(this.EventSourceName, null);
                logger.LogEvent(TraceEventType.Error, (ushort)System.Runtime.Diagnostics.EventLogCategory.Tracing, (uint)System.Runtime.Diagnostics.EventLogEventId.FailedToSetupTracing, false,
                                e.ToString());
            }
        }
 internal DiagnosticTrace(TraceSourceKind sourceType, string traceSourceName, string eventSourceName)
 {
     this.traceSourceType       = sourceType;
     this.TraceSourceName       = traceSourceName;
     this.eventSourceName       = eventSourceName;
     this.AppDomainFriendlyName = AppDomain.CurrentDomain.FriendlyName;
     try
     {
         this.CreateTraceSource();
         this.UnsafeAddDomainEventHandlersForCleanup();
     }
     catch (ConfigurationErrorsException)
     {
         throw;
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         new System.ServiceModel.Diagnostics.EventLogger(this.eventSourceName, null).LogEvent(TraceEventType.Error, EventLogCategory.Tracing, (System.ServiceModel.Diagnostics.EventLogEventId)(-1073676188), false, new string[] { exception.ToString() });
     }
 }
예제 #4
0
 internal DiagnosticTrace(TraceSourceKind sourceType, string traceSourceName, string eventSourceName)
 {
     this.traceSourceType       = sourceType;
     this.TraceSourceName       = traceSourceName;
     this.eventSourceName       = eventSourceName;
     this.AppDomainFriendlyName = AppDomain.CurrentDomain.FriendlyName;
     try
     {
         this.CreateTraceSource();
         AppDomain currentDomain = AppDomain.CurrentDomain;
         this.haveListeners  = this.TraceSource.Listeners.Count > 0;
         this.tracingEnabled = this.HaveListeners;
         if (this.TracingEnabled)
         {
             currentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.UnhandledExceptionHandler);
             this.SetLevel(this.TraceSource.Switch.Level);
             currentDomain.DomainUnload += new EventHandler(this.ExitOrUnloadEventHandler);
             currentDomain.ProcessExit  += new EventHandler(this.ExitOrUnloadEventHandler);
         }
     }
     catch (ConfigurationErrorsException configurationErrorsException)
     {
         throw;
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         Microsoft.ServiceBus.Diagnostics.EventLogger eventLogger = new Microsoft.ServiceBus.Diagnostics.EventLogger(this.eventSourceName, null);
         string[] str = new string[] { exception.ToString() };
         eventLogger.LogEvent(TraceEventType.Error, EventLogCategory.Tracing, Microsoft.ServiceBus.Diagnostics.EventLogEventId.FailedToSetupTracing, false, str);
     }
 }
 internal DiagnosticTrace(TraceSourceKind sourceType, string traceSourceName, string eventSourceName)
 {
     this.traceSourceType = sourceType;
     this.TraceSourceName = traceSourceName;
     this.eventSourceName = eventSourceName;
     this.AppDomainFriendlyName = AppDomain.CurrentDomain.FriendlyName;
     try
     {
         this.CreateTraceSource();
         this.UnsafeAddDomainEventHandlersForCleanup();
     }
     catch (ConfigurationErrorsException)
     {
         throw;
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         new System.ServiceModel.Diagnostics.EventLogger(this.eventSourceName, null).LogEvent(TraceEventType.Error, EventLogCategory.Tracing, (System.ServiceModel.Diagnostics.EventLogEventId) (-1073676188), false, new string[] { exception.ToString() });
     }
 }
 internal static void InitDiagnosticTraceImpl(TraceSourceKind sourceType, string traceSourceName)
 {
     diagnosticTrace = new System.ServiceModel.Diagnostics.DiagnosticTrace(sourceType, traceSourceName, "System.ServiceModel 4.0.0.0");
     UpdateLevel();
 }
 internal static void InitDiagnosticTraceImpl(TraceSourceKind sourceType, string traceSourceName)
 {
     diagnosticTrace = new System.ServiceModel.Diagnostics.DiagnosticTrace(sourceType, traceSourceName, "System.Runtime.Serialization 4.0.0.0");
     UpdateLevel();
 }
예제 #8
0
 internal static void InitDiagnosticTraceImpl(TraceSourceKind sourceType, string traceSourceName)
 {
     DiagnosticUtility.diagnosticTrace = new Microsoft.ServiceBus.Diagnostics.DiagnosticTrace(sourceType, traceSourceName, "System.ServiceModel 3.0.0.0");
 }
 internal static void InitDiagnosticTraceImpl(TraceSourceKind sourceType, string traceSourceName)
 {
     diagnosticTrace = new System.ServiceModel.Diagnostics.DiagnosticTrace(sourceType, traceSourceName, "Microsoft.Transactions.Bridge 4.0.0.0");
     UpdateLevel();
 }
 internal static void InitDiagnosticTraceImpl(TraceSourceKind sourceType, string traceSourceName)
 {
     diagnosticTrace = new System.ServiceModel.Diagnostics.DiagnosticTrace(sourceType, traceSourceName, "Microsoft.Transactions.Bridge 4.0.0.0");
     UpdateLevel();
 }