zoukankan      html  css  js  c++  java
  • 获取应用程序的日志信息

    实现效果:

      

    知识运用:

      EventLog类的Log属性  Entries属性  

      EventLogEntryCollection类的Count属性 及 EventLogEntry类的相关属性

    实现代码:

            private void button1_Click(object sender, EventArgs e)
            {
                this.eventLog1.Log = "Application";
                EventLogEntryCollection collection = eventLog1.Entries;
                string info = "显示应用程序日志:" + collection.Count + "个事件";
                foreach (EventLogEntry entry in collection)                          //遍历获取到的日志
                {
                    info += "
    
     类型:" + entry.EntryType;
                    info += "
    
     日期:" + entry.TimeGenerated.ToLongDateString();
                    info += "
    
     时间:" + entry.TimeGenerated.ToLongTimeString();
                    info += "
    
     来源:" + entry.Source;
                    info += "
    
     事件:" + entry.EventID.ToString();
                    info += "
    
     用户:" + entry.UserName;
                    info += "
    
    计算机:" + entry.MachineName;
                }
                richTextBox1.Text = info;
            }
    

      

  • 相关阅读:
    update语句中存在''语法书写方式
    CSS的代码风格
    CSS的语法规范
    CSS层叠样式表导读
    CSS简介
    HTML基本标签(下)
    HTML基本标签(上)
    HTML简介导读
    集合及其运用
    字典的镶嵌
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10300498.html
Copyright © 2011-2022 走看看