コード例 #1
0
        static internal void TraceTransfer(Guid newId)
        {
            Guid oldId = DiagnosticTrace.GetActivityId();

            if (DiagnosticTrace.ShouldCorrelate && newId != oldId)
            {
                if (DiagnosticTrace.HaveListeners)
                {
                    try
                    {
                        if (newId != oldId)
                        {
                            DiagnosticTrace.TraceSource.TraceTransfer(0, null, newId);
                        }
                    }
                    catch (OutOfMemoryException)
                    {
                        throw;
                    }
                    catch (StackOverflowException)
                    {
                        throw;
                    }
                    catch (ThreadAbortException)
                    {
                        throw;
                    }
                    catch (Exception e)
                    {
                        LogTraceFailure(null, e);
                    }
                }
            }
        }
コード例 #2
0
        static internal void TraceAndLogEvent(TraceEventType type, string code, string description, TraceRecord trace, Exception exception, ref Guid activityId, object source)
        {
            bool   shouldTrace = DiagnosticTrace.ShouldTrace(type);
            string traceString = null;

            try
            {
                LogEvent(type, code, description, trace, exception, source);

                if (shouldTrace)
                {
                    DiagnosticTrace.TraceEvent(type, code, description, trace, exception, ref activityId, false, source);
                }
            }
            catch (OutOfMemoryException)
            {
                throw;
            }
            catch (StackOverflowException)
            {
                throw;
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (Exception e)
            {
                LogTraceFailure(traceString, e);
            }
        }
コード例 #3
0
        static void LogEvent(TraceEventType type, string code, string description, TraceRecord trace, Exception exception, object source)
        {
            StringBuilder traceString = new StringBuilder(SR.GetString(SR.EventLogValue,
                                                                       DiagnosticTrace.ProcessName,
                                                                       DiagnosticTrace.ProcessId.ToString(CultureInfo.CurrentCulture),
                                                                       code,
                                                                       description));

            if (source != null)
            {
                traceString.AppendLine(SR.GetString(SR.EventLogSourceValue, DiagnosticTrace.CreateSourceString(source)));
            }

            if (exception != null)
            {
                traceString.AppendLine(SR.GetString(SR.EventLogExceptionValue, exception.ToString()));
            }

            if (trace != null)
            {
                traceString.AppendLine(SR.GetString(SR.EventLogEventIdValue, trace.EventId));
                traceString.AppendLine(SR.GetString(SR.EventLogTraceValue, trace.ToString()));
            }

            LogEvent(type, traceString.ToString(), false);
        }
コード例 #4
0
 static internal void GetActivityId(ref Guid guid)
 {
     //If activity id propagation is disabled for performance, we return nothing avoiding CallContext access.
     if (DiagnosticTrace.ShouldCorrelate)
     {
         guid = DiagnosticTrace.GetActivityId();
     }
 }
 internal static void Trace(string traceSource)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         DiagnosticTrace.TraceEvent(TraceEventType.Warning, "http://msdn.microsoft.com/2004/06/System/Transactions/ConfiguredDefaultTimeoutAdjusted", System.Transactions.SR.GetString("TraceConfiguredDefaultTimeoutAdjusted"), record);
     }
 }
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.txTraceId   = txTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Warning, "http://msdn.microsoft.com/2004/06/System/Transactions/TransactionScopeIncomplete", System.Transactions.SR.GetString("TraceTransactionScopeIncomplete"), record);
     }
 }
 internal static void Trace(string traceSource, Exception exception)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.exception   = exception;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose, "http://msdn.microsoft.com/2004/06/System/Transactions/ExceptionConsumed", System.Transactions.SR.GetString("TraceExceptionConsumed"), record);
     }
 }
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.txTraceId   = txTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose, "http://msdn.microsoft.com/2004/06/System/Transactions/TransactionDeserialized", System.Transactions.SR.GetString("TraceTransactionDeserialized"), record);
     }
 }
コード例 #9
0
 static XPathNavigator BuildTraceString(TraceEventType type,
                                        string code,
                                        string description,
                                        TraceRecord trace,
                                        Exception exception,
                                        object source)
 {
     return(DiagnosticTrace.BuildTraceString(new PlainXmlWriter(), type, code, description, trace, exception, source));
 }
コード例 #10
0
 internal static void Trace(string traceSource, string methodName)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.methodName  = methodName;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose, "http://msdn.microsoft.com/2004/06/System/Transactions/MethodExited", System.Transactions.SR.GetString("TraceMethodExited"), record);
     }
 }
 internal static void Trace(string traceSource, string exceptionMessage)
 {
     lock (record)
     {
         record.traceSource      = traceSource;
         record.exceptionMessage = exceptionMessage;
         DiagnosticTrace.TraceEvent(TraceEventType.Error, "http://msdn.microsoft.com/2004/06/System/Transactions/TransactionException", System.Transactions.SR.GetString("TraceTransactionException"), record);
     }
 }
 internal static void Trace(string traceSource, Guid rmId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.rmId        = rmId;
         DiagnosticTrace.TraceEvent(TraceEventType.Information, "http://msdn.microsoft.com/2004/06/System/Transactions/RecoveryComplete", System.Transactions.SR.GetString("TraceRecoveryComplete"), record);
     }
 }
コード例 #13
0
 internal static void Trace(string traceSource, Type tmType, string nodeName)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.tmType      = tmType;
         record.nodeName    = nodeName;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose, "http://msdn.microsoft.com/2004/06/System/Transactions/TransactionManagerCreated", System.Transactions.SR.GetString("TraceTransactionManagerCreated"), record);
     }
 }
コード例 #14
0
 internal static void Trace(string traceSource, EnlistmentTraceIdentifier enTraceId, EnlistmentCallback callback)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.enTraceId   = enTraceId;
         record.callback    = callback;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose, "http://msdn.microsoft.com/2004/06/System/Transactions/EnlistmentCallbackPositive", System.Transactions.SR.GetString("TraceEnlistmentCallbackPositive"), record);
     }
 }
 internal static void Trace(string traceSource, EnlistmentTraceIdentifier enTraceId, NotificationCall notCall)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.enTraceId   = enTraceId;
         record.notCall     = notCall;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose, "http://msdn.microsoft.com/2004/06/System/Transactions/EnlistmentNotificationCall", System.Transactions.SR.GetString("TraceEnlistmentNotificationCall"), record);
     }
 }
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId, DependentCloneOption option)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.txTraceId   = txTraceId;
         record.option      = option;
         DiagnosticTrace.TraceEvent(TraceEventType.Information, "http://msdn.microsoft.com/2004/06/System/Transactions/DependentCloneCreated", System.Transactions.SR.GetString("TraceDependentCloneCreated"), record);
     }
 }
 internal static void Trace(string traceSource, TransactionTraceIdentifier localTxTraceId, TransactionTraceIdentifier distTxTraceId)
 {
     lock (record)
     {
         record.traceSource    = traceSource;
         record.localTxTraceId = localTxTraceId;
         record.distTxTraceId  = distTxTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Information, "http://msdn.microsoft.com/2004/06/System/Transactions/TransactionPromoted", System.Transactions.SR.GetString("TraceTransactionPromoted"), record);
     }
 }
コード例 #18
0
 internal static void Trace(string traceSource, TransactionTraceIdentifier scopeTxTraceId, TransactionTraceIdentifier currentTxTraceId)
 {
     lock (record)
     {
         record.traceSource      = traceSource;
         record.scopeTxTraceId   = scopeTxTraceId;
         record.currentTxTraceId = currentTxTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Warning, "http://msdn.microsoft.com/2004/06/System/Transactions/TransactionScopeCurrentTransactionChanged", System.Transactions.SR.GetString("TraceTransactionScopeCurrentTransactionChanged"), record);
     }
 }
コード例 #19
0
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId, TransactionScopeResult txScopeResult)
 {
     lock (record)
     {
         record.traceSource   = traceSource;
         record.txTraceId     = txTraceId;
         record.txScopeResult = txScopeResult;
         DiagnosticTrace.TraceEvent(TraceEventType.Information, "http://msdn.microsoft.com/2004/06/System/Transactions/TransactionScopeCreated", System.Transactions.SR.GetString("TraceTransactionScopeCreated"), record);
     }
 }
コード例 #20
0
 internal static void Trace(string traceSource, EnlistmentTraceIdentifier enTraceId, EnlistmentType enType, EnlistmentOptions enOptions)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.enTraceId   = enTraceId;
         record.enType      = enType;
         record.enOptions   = enOptions;
         DiagnosticTrace.TraceEvent(TraceEventType.Information, "http://msdn.microsoft.com/2004/06/System/Transactions/Enlistment", System.Transactions.SR.GetString("TraceEnlistment"), record);
     }
 }
コード例 #21
0
 internal static void Trace(string traceSource)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         DiagnosticTrace.TraceEvent(TraceEventType.Warning,
                                    TransactionsTraceCode.ConfiguredDefaultTimeoutAdjusted,
                                    SR.GetString(SR.TraceConfiguredDefaultTimeoutAdjusted),
                                    record);
     }
 }
コード例 #22
0
 internal static void Trace(string traceSource, string methodName)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.methodName  = methodName;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose,
                                    TransactionsTraceCode.MethodExited,
                                    SR.GetString(SR.TraceMethodExited),
                                    record);
     }
 }
コード例 #23
0
 internal static void Trace(string traceSource, Exception exception)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.exception   = exception;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose,
                                    TransactionsTraceCode.ExceptionConsumed,
                                    SR.GetString(SR.TraceExceptionConsumed),
                                    record);
     }
 }
コード例 #24
0
 public void Dispose()
 {
     if (this.mustDispose)
     {
         this.mustDispose = false;
         if (this.emitTransfer)
         {
             DiagnosticTrace.TraceTransfer(this.oldGuid);
         }
         DiagnosticTrace.SetActivityId(this.oldGuid);
     }
 }
コード例 #25
0
 internal static void Trace(string traceSource, Guid rmId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.rmId        = rmId;
         DiagnosticTrace.TraceEvent(TraceEventType.Information,
                                    TransactionsTraceCode.Reenlist,
                                    SR.GetString(SR.TraceReenlist),
                                    record);
     }
 }
コード例 #26
0
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.txTraceId   = txTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Verbose,
                                    TransactionsTraceCode.CloneCreated,
                                    SR.GetString(SR.TraceCloneCreated),
                                    record);
     }
 }
コード例 #27
0
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.txTraceId   = txTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Information,
                                    TransactionsTraceCode.DependentCloneComplete,
                                    SR.GetString(SR.TraceDependentCloneComplete),
                                    record);
     }
 }
コード例 #28
0
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.txTraceId   = txTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Warning,
                                    TransactionsTraceCode.TransactionTimeout,
                                    SR.GetString(SR.TraceTransactionTimeout),
                                    record);
     }
 }
コード例 #29
0
 internal static void Trace(string traceSource, TransactionTraceIdentifier txTraceId)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.txTraceId   = txTraceId;
         DiagnosticTrace.TraceEvent(TraceEventType.Information,
                                    TransactionsTraceCode.TransactionScopeDisposed,
                                    SR.GetString(SR.TraceTransactionScopeDisposed),
                                    record);
     }
 }
コード例 #30
0
 internal static void Trace(string traceSource, string exceptionMessage)
 {
     lock (record)
     {
         record.traceSource      = traceSource;
         record.exceptionMessage = exceptionMessage;
         DiagnosticTrace.TraceEvent(TraceEventType.Critical,
                                    TransactionsTraceCode.InternalError,
                                    SR.GetString(SR.TraceInternalError),
                                    record);
     }
 }