Beispiel #1
0
        private void Trace(SystemProbe.Status status, string msg)
        {
            this.timer.Stop();
            if (!string.IsNullOrEmpty(this.ActivityId))
            {
                SystemProbe.ActivityId = new Guid(this.ActivityId);
            }
            StringBuilder stringBuilder = new StringBuilder(this.lastKnownCheckpoint);

            if (!string.IsNullOrEmpty(msg))
            {
                stringBuilder.AppendFormat(" Msg:{0}", msg);
            }
            if (this.warnings.Count > 0)
            {
                stringBuilder.AppendFormat(" Warning:{0}", string.Join(",", this.warnings));
            }
            stringBuilder.AppendFormat(" Total:{0}", this.timer.ElapsedMilliseconds);
            foreach (Diagnostics.Timing timing in this.timings.Values)
            {
                timing.Stop(this.timer.ElapsedMilliseconds);
                stringBuilder.AppendFormat(" {0}", timing);
            }
            SystemProbe.Trace("FFO-RWS-FfoReportingTask", status, stringBuilder.ToString(), new object[0]);
        }
Beispiel #2
0
 public static void Trace(string component, SystemProbe.Status status, string formatString, params object[] args)
 {
     if (!SystemProbe.IsTraceEnabled())
     {
         return;
     }
     SystemProbe.AddToLog(SystemProbe.ActivityId, component, status, formatString, args);
 }
Beispiel #3
0
        private static void AddToLog(Guid activityId, string component, SystemProbe.Status status, string formatString, params object[] args)
        {
            string value = string.Empty;

            try
            {
                value = string.Format(CultureInfo.InvariantCulture, formatString, args);
            }
            catch (ArgumentNullException)
            {
                SystemProbe.EventLogger.LogEvent(FfoSystemProbeEventLogConstants.Tuple_SystemProbeFormatArgumentNullException, component, new object[0]);
                return;
            }
            catch (FormatException ex)
            {
                SystemProbe.EventLogger.LogEvent(FfoSystemProbeEventLogConstants.Tuple_SystemProbeFormatException, component, new object[]
                {
                    ex.Message
                });
                return;
            }
            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            list.Add(new KeyValuePair <string, string>("SysProbe", string.Empty));
            list.Add(new KeyValuePair <string, string>("Server", SystemProbe.hostName));
            list.Add(new KeyValuePair <string, string>("Component", component));
            list.Add(new KeyValuePair <string, string>("Status", status.ToString()));
            list.Add(new KeyValuePair <string, string>("Message", value));
            List <List <KeyValuePair <string, string> > > list2 = new List <List <KeyValuePair <string, string> > >();

            list2.Add(list);
            LogRowFormatter logRowFormatter = new LogRowFormatter(SystemProbe.sysProbeSchema);

            logRowFormatter[0]  = (SystemProbe.startTime + SystemProbe.stopwatch.Elapsed).ToString("yyyy-MM-ddTHH\\:mm\\:ss.ffffffZ", DateTimeFormatInfo.InvariantInfo);
            logRowFormatter[10] = activityId;
            logRowFormatter[11] = activityId;
            logRowFormatter[8]  = MessageTrackingEvent.SYSPROBEINFO;
            logRowFormatter[7]  = MessageTrackingSource.AGENT;
            logRowFormatter[23] = SystemProbeConstants.TenantID;
            logRowFormatter[26] = LoggingFormatter.GetAgentInfoString(list2);
            logRowFormatter[12] = new string[]
            {
                "*****@*****.**"
            };
            if (SystemProbe.log != null)
            {
                SystemProbe.log.Append(logRowFormatter, -1);
            }
        }