Ejemplo n.º 1
0
 private static void SetMDC(TraceContextDetail result)
 {
     MDC.Set("user", result.AuditId);
     MDC.Set("ApplicationId", result.ApplicationId);
     MDC.Set("StackTrace", result.StackTrace);
     MDC.Set("Computer", result.Computer);
     MDC.Set("ConnectionKey", result.ConnectionKey);
 }
Ejemplo n.º 2
0
        public static void LogDebug(string message, string logger, int applicationId, string connectionKey = "", string auditId = "")
        {
            var result = new TraceContextDetail();

            try
            {
                result.SetSetttings(message, logger, applicationId.ToString(), connectionKey, auditId, Environment.StackTrace);

                SetMDC(result);

                var log = LogManager.GetLogger(logger);
                log.Debug(message);
            }
            catch { }
        }
Ejemplo n.º 3
0
        public static TraceContextDetail LogInfo(string message, string logger, string applicationId, string connectionKey = "", string auditId = "")
        {
            var result = new TraceContextDetail();

            //try
            //{
            result.SetSetttings(message, logger, applicationId, connectionKey, auditId, Environment.StackTrace);

            SetMDC(result);

            var log = LogManager.GetLogger(logger);

            log.Info(message);
            //}
            //catch (Exception e)
            //{
            //	Debug.WriteLine(e.Message);
            //}

            return(result);
        }
Ejemplo n.º 4
0
 public TraceContext(TraceContextDetail detail) : this()
 {
     Detail = detail;
     Stopwatch.Start();
 }