private static void LogInternal(MessageLogTraceRecord record)
        {
            PlainXmlWriter writer = new PlainXmlWriter(MaxMessageSize);

            try
            {
                record.WriteTo(writer);
                writer.Close();
                TraceXPathNavigator data = writer.Navigator;
                if (((messageTraceSource != null) && !messageTraceSource.ShouldLogPii) || !LogKnownPii)
                {
                    data.RemovePii(PiiHeadersPaths);
                    if ((LogMessageBody && (record.Message != null)) && HasSecurityAction(record.Message))
                    {
                        data.RemovePii(PiiBodyPaths);
                    }
                }
                LogInternal(record.MessageLoggingSource, data);
            }
            catch (PlainXmlWriter.MaxSizeExceededException)
            {
                if (DiagnosticUtility.ShouldTraceWarning)
                {
                    TraceUtility.TraceEvent(TraceEventType.Warning, 0x2000b, System.ServiceModel.SR.GetString("TraceCodeMessageNotLoggedQuotaExceeded"), record.Message);
                }
            }
        }
Ejemplo n.º 2
0
        static void LogInternal(MessageLogTraceRecord record)
        {
            Fx.Assert(null != record, "record cannot be null");

            PlainXmlWriter xmlWriter = new PlainXmlWriter(MessageLogger.MaxMessageSize);

            try
            {
                record.WriteTo(xmlWriter);
                xmlWriter.Close();
                TraceXPathNavigator navigator = xmlWriter.Navigator;

                if ((MessageLogger.messageTraceSource != null &&
                     !MessageLogger.messageTraceSource.ShouldLogPii) ||
                    !MessageLogger.LogKnownPii)
                {
                    navigator.RemovePii(MessageLogger.PiiHeadersPaths);
                    if (MessageLogger.LogMessageBody && null != record.Message)
                    {
                        if (HasSecurityAction(record.Message))
                        {
                            navigator.RemovePii(MessageLogger.PiiBodyPaths);
                        }
                    }
                }

                LogInternal(record.MessageLoggingSource, navigator);
            }
            catch (PlainXmlWriter.MaxSizeExceededException)
            {
                if (DiagnosticUtility.ShouldTraceWarning)
                {
                    TraceUtility.TraceEvent(TraceEventType.Warning, TraceCode.MessageNotLoggedQuotaExceeded,
                                            SR.GetString(SR.TraceCodeMessageNotLoggedQuotaExceeded), record.Message);
                }
            }
        }
Ejemplo n.º 3
0
        static void LogInternal(MessageLogTraceRecord record)
        {
            Fx.Assert(null != record, "record cannot be null");

            PlainXmlWriter xmlWriter = new PlainXmlWriter(MessageLogger.MaxMessageSize);

            try
            {
                record.WriteTo(xmlWriter);
                xmlWriter.Close();
                TraceXPathNavigator navigator = xmlWriter.Navigator;
                
                if ((MessageLogger.messageTraceSource != null && 
                    !MessageLogger.messageTraceSource.ShouldLogPii) ||
                    !MessageLogger.LogKnownPii)
                {
                    navigator.RemovePii(MessageLogger.PiiHeadersPaths);
                    if (MessageLogger.LogMessageBody && null != record.Message)
                    {
                        if (HasSecurityAction(record.Message))
                        {
                            navigator.RemovePii(MessageLogger.PiiBodyPaths);
                        }
                    }
                }

                LogInternal(record.MessageLoggingSource, navigator);
            }
            catch (PlainXmlWriter.MaxSizeExceededException)
            {
                if (DiagnosticUtility.ShouldTraceWarning)
                {
                    TraceUtility.TraceEvent(TraceEventType.Warning, TraceCode.MessageNotLoggedQuotaExceeded,
                        SR.GetString(SR.TraceCodeMessageNotLoggedQuotaExceeded), record.Message);
                }
            }
        }
 private static void LogInternal(MessageLogTraceRecord record)
 {
     PlainXmlWriter writer = new PlainXmlWriter(MaxMessageSize);
     try
     {
         record.WriteTo(writer);
         writer.Close();
         TraceXPathNavigator data = writer.Navigator;
         if (((messageTraceSource != null) && !messageTraceSource.ShouldLogPii) || !LogKnownPii)
         {
             data.RemovePii(PiiHeadersPaths);
             if ((LogMessageBody && (record.Message != null)) && HasSecurityAction(record.Message))
             {
                 data.RemovePii(PiiBodyPaths);
             }
         }
         LogInternal(record.MessageLoggingSource, data);
     }
     catch (PlainXmlWriter.MaxSizeExceededException)
     {
         if (DiagnosticUtility.ShouldTraceWarning)
         {
             TraceUtility.TraceEvent(TraceEventType.Warning, 0x2000b, System.ServiceModel.SR.GetString("TraceCodeMessageNotLoggedQuotaExceeded"), record.Message);
         }
     }
 }