当前位置: 首页>>代码示例>>C#>>正文


C# ErrorLog类代码示例

本文整理汇总了C#中ErrorLog的典型用法代码示例。如果您正苦于以下问题:C# ErrorLog类的具体用法?C# ErrorLog怎么用?C# ErrorLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ErrorLog类属于命名空间,在下文中一共展示了ErrorLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    //===============================================================
    // Function: Page_Load
    //===============================================================
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DbConnection conn = new SqlConnection(GlobalSettings.connectionString);
            try
            {
                conn.Open();

                DbCommand cmd = conn.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "SELECT HomePageContent FROM HomePageContent ";
                DbDataReader rdr = cmd.ExecuteReader();
                rdr.Read();
                homePageContentTextBox.Text = (string)rdr["HomePageContent"];
                rdr.Close();
            }
            catch (Exception ex)
            {
                ErrorLog errorLog = new ErrorLog();
                errorLog.WriteLog("", "", ex.Message, logMessageLevel.errorMessage);
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
    }
开发者ID:sedogo,项目名称:site,代码行数:32,代码来源:homePageContent.aspx.cs

示例2: Register

    protected void Register(object sender, EventArgs e)
    {
        try
        {
            if (lnkRegister.Text == "Profile")
            {
                Response.Redirect("/profile", false);
            }
            else
            {
                Response.Redirect("/register", false);
            }
        }
        catch (Exception ex)
        {
            UserInfo info = UserController.GetCurrentUserInfo();
            ErrorLog objLog = new ErrorLog();
            objLog.ErrorDescription = ex.ToString();
            objLog.ErrorDate = DateTime.Now;
            objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
            objLog.ErrorLoggedInUser = info.Username;
            objLog.AddErrorToLog(objLog);

        }
    }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:26,代码来源:Header.ascx.cs

示例3: SelectRemoteSystem

        public SelectRemoteSystem(APPLICATION_DATA appData)
        {
            InitializeComponent();
            m_AppData = appData;
            m_AppData.AddOnClosing(OnClose, APPLICATION_DATA.CLOSE_ORDER.FIRST);
            m_Log = (ErrorLog) m_AppData.Logger;

            m_AppData.CurrentlyLoggedInRemoteServer = (object)new RemoteHosts(m_AppData, true);// assign a nullHost as a place holder until the use selects an actual server

            MessageGenerators = new MessageGeneratorEvents(this);

            buttonLogout.Visible = false;
            buttonLogout.Enabled = false;

            m_StatsViewer = new StatsViewer(m_AppData);
            //744, 57
            m_StatsViewer.Location = new Point(744, 57);
            this.Controls.Add(m_StatsViewer);

            bool hostsLoaded = false;
            string hostfile = UserSettings.Get(UserSettingTags.REMOTEHOSTS_LastHostFileUsed);
            if (hostfile != null)
            {
                if (File.Exists(hostfile))
                {
                    m_HostFile = hostfile;
                    LoadHostsFromFile(hostfile);
                    hostsLoaded = true;
                }
            }
            if ( ! hostsLoaded)
                AddLocalDefaultHost();
        }
开发者ID:anndream,项目名称:anpr-1,代码行数:33,代码来源:SelectRemoteSystem.cs

示例4: LogError

 public static bool LogError(ErrorLog ErrorLog)
 {
     try
     {
         if (_errorsRepository == null)
         {
             _errorsRepository = new ErrorsRepository();
         }
         _errorsRepository.Add(ErrorLog);
         return _errorsRepository.Save();
     }
     catch (Exception ex)
     {
         //Intenta guardar en un log físico
         try
         {
             using (StreamWriter writer = new StreamWriter(System.Web.HttpContext.Current.Server.MapPath("~/")+"errorLog.txt", true))
             {
                 StringBuilder errorText = new StringBuilder();
                 errorText.Append(DateTime.UtcNow.GetCurrentTime().GetCurrentTime().ToShortDateString() + " " + DateTime.UtcNow.GetCurrentTime().ToShortTimeString());
                 errorText.Append(" | " + ((enumMessageType)ErrorLog.ErrorType).ToString());
                 errorText.Append(" | " + (string.IsNullOrEmpty(ErrorLog.ErrorCode) ? " " : ErrorLog.ErrorCode));
                 errorText.Append(" | " + ErrorLog.Message);
                 errorText.Append(" | " + ErrorLog.IP);
                 writer.WriteLine(errorText.ToString());
             }
             return true;
         }
         catch (Exception ex2)
         {
             //Tampoco pudo guardar en arhivo
             return false;
         }
     }
 }
开发者ID:JuliusCesarius,项目名称:EvolucionaMovil,代码行数:35,代码来源:ErrorHandler.cs

示例5: FillArticle

    public void FillArticle(int SiteId, string keyword, int MatchType)
    {
        try
        {

            //articleCount = "Your Query <b><i>" + keyword + "</i></b> returned " + customTransactions.GetSearchResults(1, keyword, SortMethod,MatchType).Rows.Count.ToString() + " record(s) ";
			dtSearchResults = null;
            dtSearchResults = customTransactions.GetSearchResults(1, keyword, SortMethod, MatchType);
			articleCount = (MatchType == 1) ? "Your Query <b><i>&#8220;" + keyword + "&#8221;</i></b> returned " + dtSearchResults.Rows.Count.ToString() + " record(s) " : "Your Query <b><i>" + keyword + "</i></b> returned " + dtSearchResults.Rows.Count.ToString() + " record(s)";
            if (customTransactions.GetSearchResults(1, keyword, SortMethod,MatchType).Rows.Count != 0)
            {
                gridArticle.DataSource = customTransactions.GetSearchResults(1, keyword, SortMethod, MatchType);
                gridArticle.DataBind();
            }
            else
            {
                // dvArticleCount.InnerHtml  = "Your Query <b><i>" + keyword + "</i></b> returned no record(s) for ARTICLE";
                gridArticle.DataSource = null;
                gridArticle.DataBind();
                dvArticleCount.InnerText = "No Records Found";
            }
        }
        catch (Exception ex)
        {
            UserInfo info = UserController.GetCurrentUserInfo();
            ErrorLog objLog = new ErrorLog();
            objLog.ErrorDescription = ex.ToString();
            objLog.ErrorDate = DateTime.Now;
            objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
            objLog.ErrorLoggedInUser = info.Username;
            objLog.AddErrorToLog(objLog);
        }
    }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:34,代码来源:SearchResult.ascx.cs

示例6: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         SqlDataAdapter da = new SqlDataAdapter("sp_section",new SqlConnection(customTransactions.connectionString));
         da.SelectCommand.CommandType = CommandType.StoredProcedure;
         da.SelectCommand.Parameters.AddWithValue("@Categoryid", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["News"]));
         da.SelectCommand.Parameters.AddWithValue("@rows", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["newsrows"]));
         DataTable dt = new DataTable();
         da.Fill(dt);
         rptnews.DataSource = dt;
         rptnews.DataBind();
     }
     catch (Exception ex)
     {
         UserInfo info = UserController.GetCurrentUserInfo();
         ErrorLog objLog = new ErrorLog();
         objLog.ErrorDescription = ex.ToString();
         objLog.ErrorDate = DateTime.Now;
         objLog.ErrorFunctionName = "Page Load";
         objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
         objLog.ErrorLoggedInUser = info.Username;
         objLog.AddErrorToLog(objLog);
     }
 }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:25,代码来源:HomeNews.ascx.cs

示例7: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            SqlDataAdapter da = new SqlDataAdapter("sp_HomeDepartment_Articles", new SqlConnection(customTransactions.connectionString));
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@Id1", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["AVSystems"]));
            da.SelectCommand.Parameters.AddWithValue("@Id2", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["LawEnforcement"]));
            da.SelectCommand.Parameters.AddWithValue("@Id3", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Production"]));            
            da.Fill(ds);
            dldepartments.DataSource = ds;
            dldepartments.DataBind();
        }
        catch (Exception ex)
        {

            UserInfo info = UserController.GetCurrentUserInfo();
            ErrorLog objLog = new ErrorLog();
            objLog.ErrorDescription = ex.ToString();
            objLog.ErrorDate = DateTime.Now;
            objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
            objLog.ErrorLoggedInUser = info.Username;
            objLog.AddErrorToLog(objLog);

        }
    }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:27,代码来源:HomeDepartments.ascx.cs

示例8: SmartSearchLibUC

        public SmartSearchLibUC(APPLICATION_DATA appData, ABORT_CLOSE giveup)
        {
            InitializeComponent();

            m_AppData = appData;
            m_AppData.AddOnClosing(OnClose,APPLICATION_DATA.CLOSE_ORDER.FIRST);
            m_Log = (ErrorLog)m_AppData.Logger;
            GiveUp = giveup;

            m_PathManager= (PATHS) m_AppData.PathManager ;

            textBoxMinMatch.Text = "0";

            m_SearchTool = new SearchLib(m_AppData);

            this.Text = "Smart Search";

            m_ZoomTrackLock = new object();
            trackBarZoomControl.Minimum = 0;
            trackBarZoomControl.Maximum = 1000;

            buttonUndoDelete.Enabled = false;
            dataGridView1.KeyDown += new KeyEventHandler(dataGridView1_KeyDown);

            dataGridView1.CellClick +=new DataGridViewCellEventHandler(dataGridView1_CellContentClick); // mouse click on cell
            dataGridView1.SelectionChanged += new EventHandler(dataGridView1_SelectionChanged);  // support cell selection changes by keyboard (i.e. not by mouse click)

            dataGridView1.Columns["time"].DefaultCellStyle.Format = m_AppData.TimeFormatStringForDisplay;// "dd MMM yyyy,  HH: mm: ss: ffff";

            m_SearchStatusDisplay = new SearchStatusDisplayUC(m_AppData, UserCanceledSearch);
            m_SearchStatusDisplay.Location = new Point(594, 55);
            this.Controls.Add(m_SearchStatusDisplay);
        }
开发者ID:anndream,项目名称:anpr-1,代码行数:33,代码来源:search.cs

示例9: logError

    /// bulk of code written by: Alex Marcum - 11/20/2012
    public static void logError(Exception ex)
    {
        System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(1, true);

        //System.IO.FileInfo temp = new System.IO.FileInfo(fileName);
        //fileName = temp.Name;

        //Class Name is the Whole path to the Filename
        string fileName = stackFrame.GetFileName();
        string functionName = stackFrame.GetMethod().Name.ToString();
        int line = stackFrame.GetFileLineNumber();

        try
        {
            using (CCSEntities db = new CCSEntities())
            {
                ErrorLog el = new ErrorLog();

                el.TimeStamp = DateTime.Now;
                el.FileName = fileName;
                el.FunctionName = functionName;
                el.LineNumber = line.ToString();
                el.ErrorText = ex.Message;

                db.ErrorLogs.Add(el);
                db.SaveChanges();
            }
        }
        catch (Exception /*ex*/)
        {
        }
    }
开发者ID:WsuCS3750,项目名称:CCSInventory,代码行数:33,代码来源:LogError.cs

示例10: rptDataBound

 protected void rptDataBound(object sender, DataListItemEventArgs e)
 {
     try
     {
         string str = Server.HtmlDecode(ds.Tables[0].Rows[e.Item.ItemIndex]["Article"].ToString());
         Match m = Regex.Match(str, @"<img(.|\n)+?>");
         Image ArticleImage = (Image)e.Item.FindControl("img");
         if (!string.IsNullOrEmpty(ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString()))
         {
             System.Drawing.Bitmap bmp = customTransactions.RezizeImage(Server.MapPath(ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString()), 110, 80, ArticleImage);
             ArticleImage.ImageUrl = ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString();
         }
         else if (m.Success)
         {
             Match inner = Regex.Match(m.Value, "src=[\'|\"](.+?)[\'|\"]");
             if (inner.Success)
             {
                 string imageurl = inner.Value.Substring(5).Substring(0, inner.Value.Substring(5).LastIndexOf("\""));
                 System.Drawing.Bitmap bmp = customTransactions.RezizeImage(Server.MapPath(imageurl), 110, 80, ArticleImage);
                 ArticleImage.ImageUrl = inner.Value.Substring(5).Substring(0, inner.Value.Substring(5).LastIndexOf("\""));
             }
         }
     }
     catch (Exception ex)
     {
         UserInfo info = UserController.GetCurrentUserInfo();
         ErrorLog objLog = new ErrorLog();
         objLog.ErrorDescription = ex.ToString();
         objLog.ErrorDate = DateTime.Now;
         objLog.ErrorFunctionName = "Page Load";
         objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
         objLog.ErrorLoggedInUser = info.Username;
         objLog.AddErrorToLog(objLog);
     }
 }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:35,代码来源:HomeDepartments.ascx.cs

示例11: DeleteErrorLog

 public bool DeleteErrorLog(ErrorLog errorLog)
 {
     if(errorLog==null) return false;
        _unitOfWork.ErrorLogRepository.Delete(errorLog);
        _unitOfWork.Save();
        return true;
 }
开发者ID:robela,项目名称:cats,代码行数:7,代码来源:ErrorLogService.cs

示例12: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
		try
        {
            ans1 = Session["answer"]!= null ? Session["answer"].ToString() : "";
            if (DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().UserID != -1)
            {
                //Response.Write(DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().DisplayName);                
                txtName.Text = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().DisplayName;                
            }
            else
            {
                txtName.Text = "Anonymous";                
            }
            BindComment();
        }
        catch (Exception ex)
        {
            UserInfo info = UserController.GetCurrentUserInfo();
            ErrorLog objLog = new ErrorLog();
            objLog.ErrorDescription = ex.ToString();
            objLog.ErrorDate = DateTime.Now;
            objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
            objLog.ErrorLoggedInUser = info.Username;
            objLog.AddErrorToLog(objLog);

        }
    }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:29,代码来源:ArticleComment.ascx.cs

示例13: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            SqlDataAdapter da = new SqlDataAdapter("sp_HomeTopRightArticle", new SqlConnection(customTransactions.connectionString));
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@Categoryid", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ProductReview"]));
           
            DataTable dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                title = dt.Rows[0]["Title"].ToString();
                thumbnail = "../ImageHandler.ashx?imgpath=" + dt.Rows[0]["Thumbnail"].ToString() + "&w=270&h=130";
                url = customTransactions.GenerateFriendlyURL("article", title, "0-" + dt.Rows[0]["Id"].ToString(), 0);
				teaser = dt.Rows[0]["Teaser"].ToString();
            }
        }
        catch (Exception ex)
        {
            UserInfo info = UserController.GetCurrentUserInfo();
            ErrorLog objLog = new ErrorLog();
            objLog.ErrorDescription = ex.ToString();
            objLog.ErrorDate = DateTime.Now;
            objLog.ErrorFunctionName = "Page Load";
            objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
            objLog.ErrorLoggedInUser = info.Username;
            objLog.AddErrorToLog(objLog);
        }
    }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:30,代码来源:HomeTopRightArticle.ascx.cs

示例14: Save

 public override void Save(ErrorLog errorLog)
 {
     using(var conn = Connection)
     {
         conn.Execute(Queries.Save, (DbErrorLog) errorLog);
     }
 }
开发者ID:stevenbey,项目名称:elfar,代码行数:7,代码来源:DbErrorLogProvider.cs

示例15: ControlCenterMainForm

        public ControlCenterMainForm()
        {
            InitializeComponent();

            m_ScreenLogger = new ScreenLogger();// debug tool

            // load up the AppData object so the rest of the app has acccess to global resources

            m_AppData = new APPLICATION_DATA();
            m_AppData.LogToScreen = m_ScreenLogger;

            m_Log = new ErrorLog(m_AppData);
            m_AppData.Logger = m_Log;

            m_ScreenLogger.Show();

            m_AppData.RCSProtocol = (object)new RCS_Protocol.RCS_Protocol(m_AppData,null);
            m_AppData.TCPClient = (object)new RCSClientLib.RCSClient(null, m_AppData);

            this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);

            tabControlMain.Click += new EventHandler(tabControlMain_Click);

            // not logged in

            m_AppData.LoggedIn = APPLICATION_DATA.LoggedInAs.NOT_LOGGED_IN;

            // start on the select server tab
            tabControlMain.SelectedTab = tabPageSelectServer;
            m_CurrentPage = tabControlMain.SelectedTab;
            LoadSelectServerUC();
        }
开发者ID:anndream,项目名称:anpr-1,代码行数:32,代码来源:ControlCenterMainForm.cs


注:本文中的ErrorLog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。