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); }
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 { } }
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); }
public TraceContext(TraceContextDetail detail) : this() { Detail = detail; Stopwatch.Start(); }