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); } } } }
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); } }
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); }
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); } }
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)); }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
internal static void Trace(string traceSource) { lock (record) { record.traceSource = traceSource; DiagnosticTrace.TraceEvent(TraceEventType.Warning, TransactionsTraceCode.ConfiguredDefaultTimeoutAdjusted, SR.GetString(SR.TraceConfiguredDefaultTimeoutAdjusted), record); } }
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); } }
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); } }
public void Dispose() { if (this.mustDispose) { this.mustDispose = false; if (this.emitTransfer) { DiagnosticTrace.TraceTransfer(this.oldGuid); } DiagnosticTrace.SetActivityId(this.oldGuid); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }