Ejemplo n.º 1
0
        public void AddErrorLog(ErrorLogT log)
        {
            if(!string.IsNullOrEmpty(log.Message))
                log.Message = FilterStack(log.Message);

            new ErrorLogDac().InsertErrorLog(log);
        }
Ejemplo n.º 2
0
        public void InsertErrorLog(ErrorLogT exceptionLog)
        {
            string errorDbConnstring = ConfigurationSettings.AppSettings["ErrorDbConnString"];
            SqlConnection errorDbConn = new SqlConnection(errorDbConnstring);
            SqlCommand errorDbCommand = new SqlCommand(EXCEPTION_INSERT_QUERY, errorDbConn);
            errorDbCommand.CommandType = CommandType.Text;
            errorDbCommand.Parameters.AddRange(new SqlParameter[]{
                SqlParameterHelper.CreateParameter("@TargetServer", StringSizeToFit(exceptionLog.TargetServer,20), SqlDbType.VarChar, 20),
                SqlParameterHelper.CreateParameter("@ComponentType", StringSizeToFit(exceptionLog.ComponentType,20), SqlDbType.VarChar, 20),
                SqlParameterHelper.CreateParameter("@Message", StringSizeToFit(exceptionLog.Message,2000), SqlDbType.VarChar, 2000),
                SqlParameterHelper.CreateParameter("@StackTrace", exceptionLog.StackTrace, SqlDbType.Text),
                SqlParameterHelper.CreateParameter("@UserId", StringSizeToFit(exceptionLog.UserId,10), SqlDbType.VarChar, 10),
                SqlParameterHelper.CreateParameter("@SystemNm", exceptionLog.SystemNm, SqlDbType.Char, 1),
                SqlParameterHelper.CreateParameter("@Reg_dt", exceptionLog.Reg_dt, SqlDbType.DateTime),
                SqlParameterHelper.CreateParameter("@METHOD", StringSizeToFit(exceptionLog.METHOD,200), SqlDbType.VarChar, 200),
                SqlParameterHelper.CreateParameter("@EXECSTATEMENT", StringSizeToFit(exceptionLog.EXECSTATEMENT,2000), SqlDbType.VarChar, 2000),
                SqlParameterHelper.CreateParameter("@error_domain", StringSizeToFit(exceptionLog.error_domain,512), SqlDbType.VarChar, 512)
            });

            try
            {
                errorDbConn.Open();
                errorDbCommand.ExecuteNonQuery();
                errorDbConn.Close();
            }
            catch (Exception ex)
            {
                //debug 빌드 시에만 listener에게 전달 됨.
                Debug.Write(ex);
            }
        }
Ejemplo n.º 3
0
 public SqlWriteInstance(ErrorLogT log)
 {
     _log = log;
 }
Ejemplo n.º 4
0
        private ErrorLogT MakeLogEntity(ArcheFx.Diagnostics.TraceContext context, ExceptionTraceEntry entry, string execStatement)
        {
            ErrorLogT log = new ErrorLogT();

            log.TargetServer = Environment.MachineName;
            log.ComponentType = entry.MethodInfo.ComponentType.ToString();
            log.Message = entry.Message;
            log.StackTrace = entry.StackTrace;
            log.UserId = entry.UserID;
            log.SystemNm = "E";
            log.Reg_dt = DateTime.Now;
            log.EXECSTATEMENT = execStatement;
            log.error_domain = context.HttpContext.Request.Url.Authority;

            if (null != context.HttpContext)
            {
                string path = context.HttpContext.Request.Url.AbsolutePath;

                if (false == string.IsNullOrEmpty(path))
                {
                    log.METHOD = path + @"?";
                }
                else
                {
                    log.METHOD = @"(no path)?";
                }
            }

            log.METHOD += entry.MethodInfo.Method.Name;

            return log;
        }
Ejemplo n.º 5
0
 public void AddErrorLog(ErrorLogT[] logs)
 {
     for (int i = 0; i < logs.Count(); i++)
         AddErrorLog(logs[i]);
 }