using System;
using System.Diagnostics; namespace WriteToAnEventLog_csharp
{
/// Summary description for Class1.
class Class1
{
static void Main(string[] args)
{
string sSource;
string sLog;
string sEvent; sSource = "dotNET Sample App";
sLog = "Application";
sEvent = "Sample Event"; if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource,sLog); EventLog.WriteEntry(sSource,sEvent);
EventLog.WriteEntry(sSource, sEvent,
EventLogEntryType.Warning, 234);
}
}
}

How to write to an event log by using Visual C#的更多相关文章

  1. ora-28056 (Writing audit records to Windows Event Log failed)

    系统:windows xp oracle 版本 SQL> select * from v$version; BANNER ------------------------------------ ...

  2. windows 系统无法启动windows event log 服务

    windows 系统无法启动windows event log 服务 关键词:无法启动系统事件日志 尝试解决步骤 [1]权限:把如图中logsfile文件等都给local service [2]把C: ...

  3. application pool can not write to event log

    https://stackoverflow.com/questions/9564420/the-source-was-not-found-but-some-or-all-event-logs-coul ...

  4. Event log c++ sample.

    1. Init regedit. bool InitLog( TCHAR *logName, TCHAR *sourceName, TCHAR *MessageDllName ) { // This ...

  5. AngularJS - $index, $event, $log

    原文: https://thinkster.io/egghead/index-event-log --------------------------------------------------- ...

  6. AWR发现TOP Event log file sequential read

    对客户DB进行巡检,发现TOP EVENT是LOG FILE Sequential read 等待事件说明 https://www.xuebuyuan.com/zh-hant/1743045.html ...

  7. KMS Event LOG

    The 12290 event entry gives a significant amount of information that can be used to figure out what ...

  8. 如何在 Windows Event Log 中查找系统重启的信息

    事件ID:12 事件ID 13: 事件ID 41: 事件ID 6008: 事件ID 1074:事件ID 1074: ========================================== ...

  9. Android 解读Event和Main Log

    1 Android P EventLogTags文件 Android P 9.0.0 所有EventLogTags文件List: system/bt/EventLogTags.logtags syst ...

随机推荐

  1. mongo索引命令

    http://blog.csdn.net/salmonellavaccine/article/details/53907535 1. 创建/重建索引 MongoDB全新创建索引使用ensureInde ...

  2. Java中volatile关键字解析

    一.内存模型的相关概念 大家都知道,计算机在执行程序时,每条指令都是在CPU中执行的,而执行指令过程中,势必涉及到数据的读取和写入.由于程序运行过程中的临时数据是存放在主存(物理内存)当中的,这时就存 ...

  3. linux内存源码分析 - 内存回收(匿名页反向映射)

    本文为原创,转载请注明:http://www.cnblogs.com/tolimit/ 概述 看完了内存压缩,最近在看内存回收这块的代码,发现内容有些多,需要分几块去详细说明,首先先说说匿名页的反向映 ...

  4. WindowsFormsHost下MouseWheel失效的解决办法

    原文:WindowsFormsHost下MouseWheel失效的解决办法 看了网上有些写的用钩子,但是,在Stack Overflow上找到一个简便的方式

  5. [C#]实现任何数据库类型的DbHelper帮助类

    本文章为原创内容,如需转载,请注明作者及出处,谢谢! 一.在System.Data.Common命名空间下,存在这样的一个类: // // 摘要: // 表示一组方法,这些方法用于创建提供程序对数据源 ...

  6. 微信小程序支付异常:requestPayment:fail no permission

    今天在调试微信小程序支付时碰到了这个问题,支付参数都正常生成了,在调用 wx.requestPayment 进行支付时遇到了这个报错,查了一下发现是开发者工具中 AppID 写错了,用的 AppID ...

  7. PySpider框架的基本用法

    pyspider安装: 3.7之后无法正常使用,使用可以下载Python3.6或以下,或者修改pyspider内部代码 ———————————————————————————————————————— ...

  8. MapReduce过程<原创>

    一.预处理阶段 二.Map阶段 一个Map任务被JobTracker(管家)分配到多个TaskTracker(弟弟)执行,如下图所示,弟弟的map()只负责拆分,虽然map()输出两个相同的键值对,但 ...

  9. tomcat启动参数

    /usr/java/jdk1..0_191-amd64/bin/java -Djava.util.logging.config./conf/logging.properties -Djava.util ...

  10. Apache Tomcat® - Which Version Do I Want?

    Apache Tomcat® - Which Version Do I Want?http://tomcat.apache.org/whichversion.html