コード例 #1
0
 static internal void CopyActivity(Message source, Message destination)
 {
     if (DiagnosticUtility.ShouldUseActivity)
     {
         TraceUtility.SetActivity(destination, TraceUtility.ExtractActivity(source));
     }
 }
コード例 #2
0
        internal static void ProcessIncomingMessage(Message message, EventTraceActivity eventTraceActivity)
        {
            ServiceModelActivity activity = ServiceModelActivity.Current;

            if (activity != null && DiagnosticUtility.ShouldUseActivity)
            {
                ServiceModelActivity incomingActivity = TraceUtility.ExtractActivity(message);
                if (null != incomingActivity && incomingActivity.Id != activity.Id)
                {
                    using (ServiceModelActivity.BoundOperation(incomingActivity))
                    {
                        if (null != FxTrace.Trace)
                        {
                            FxTrace.Trace.TraceTransfer(activity.Id);
                        }
                    }
                }
                TraceUtility.SetActivity(message, activity);
            }

            TraceUtility.MessageFlowAtMessageReceived(message, null, eventTraceActivity, true);

            if (MessageLogger.LogMessagesAtServiceLevel)
            {
                MessageLogger.LogMessage(ref message, MessageLoggingSource.ServiceLevelReceiveReply | MessageLoggingSource.LastChance);
            }
        }
コード例 #3
0
        internal static ServiceModelActivity ExtractAndRemoveActivity(Message message)
        {
            ServiceModelActivity retval = TraceUtility.ExtractActivity(message);

            if (retval != null)
            {
                // If the property is just removed, the item is disposed and we don't want the thing
                // to be disposed of.
                message.Properties[TraceUtility.ActivityIdKey] = false;
            }
            return(retval);
        }
コード例 #4
0
        private static void LogMessageImpl(ref Message message, XmlReader reader, MessageLoggingSource source)
        {
            ServiceModelActivity activity = DiagnosticUtility.ShouldUseActivity ? TraceUtility.ExtractActivity(message) : null;

            using (ServiceModelActivity.BoundOperation(activity))
            {
                if (ShouldLogMessages(source) && ((numberOfMessagesToLog > 0) || (numberOfMessagesToLog == -1)))
                {
                    bool flag = ((source & MessageLoggingSource.LastChance) != MessageLoggingSource.None) || ((source & MessageLoggingSource.TransportSend) != MessageLoggingSource.None);
                    source &= ~MessageLoggingSource.LastChance;
                    if (((flag || (message is NullMessage)) || (message.Version.Addressing != AddressingVersion.None)) && (MatchFilters(message, source) && ((numberOfMessagesToLog == -1) || (numberOfMessagesToLog > 0))))
                    {
                        MessageLogTraceRecord record = new MessageLogTraceRecord(ref message, reader, source, LogMessageBody);
                        LogInternal(record);
                    }
                }
            }
        }
コード例 #5
0
        static void LogMessageImpl(ref Message message, XmlReader reader, MessageLoggingSource source)
        {
            ServiceModelActivity activity = DiagnosticUtility.ShouldUseActivity ? TraceUtility.ExtractActivity(message) : null;

            using (ServiceModelActivity.BoundOperation(activity))
            {
                if (ShouldLogMessages(source) && (MessageLogger.numberOfMessagesToLog > 0 || MessageLogger.numberOfMessagesToLog == MessageLogger.Unlimited))
                {
                    bool lastChance = (source & MessageLoggingSource.LastChance) != 0 || (source & MessageLoggingSource.TransportSend) != 0;
                    source &= ~MessageLoggingSource.LastChance;
                    // MessageLogger doesn't log AddressingVersion.None in the encoder since we want to make sure we log
                    // as much of the message as possible. So let the Transport log later.
                    if ((lastChance || message is NullMessage || message.Version.Addressing != AddressingVersion.None) &&
                        MatchFilters(message, source))
                    {
                        if (MessageLogger.numberOfMessagesToLog == MessageLogger.Unlimited || MessageLogger.numberOfMessagesToLog > 0)
                        {
                            MessageLogTraceRecord record = new MessageLogTraceRecord(ref message, reader, source, MessageLogger.LogMessageBody);
                            LogInternal(record);
                        }
                    }
                }
            }
        }