如何从命令行创建 Windows EventLog 源? [英] How to create Windows EventLog source from command line?

查看:25
本文介绍了如何从命令行创建 Windows EventLog 源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 ASP.NET 应用程序,它将一些内容记录到 Windows EventLog.为此,必须首先创建一个事件源.这需要管理权限,因此我无法在 ASP.NET 应用程序中执行此操作.

I'm creating an ASP.NET application that will log some stuff to Windows EventLog. To do this an event source has to be created first. This requires administrative priviledges so I cannot do it in the ASP.NET app.

是否有与 Windows 捆绑的现有命令行应用程序可以创建事件日志源,或者我必须推出自己的应用程序?

Is there an existing command-line application that is bundled with Windows that can create an event log source, or must I roll out my own?

推荐答案

试试eventcreate.exe"

示例:

eventcreate /ID 1 /L APPLICATION /T INFORMATION  /SO MYEVENTSOURCE /D "My first log"

这将在 APPLICATION 事件 log 下创建一个名为 MYEVENTSOURCE 的新事件 source 作为 INFORMATION 事件 type.

This will create a new event source named MYEVENTSOURCE under APPLICATION event log as INFORMATION event type.

我认为此实用程序仅从 XP 开始包含.

I think this utility is included only from XP onwards.

在 CMD 中输入 eventcreate/?提示

Type eventcreate /? in CMD prompt

Microsoft TechNet:Windows 命令行参考:Eventcreate

Microsoft TechNet: Windows Command-Line Reference: Eventcreate

SS64:Windows 命令行参考:Eventcreate

SS64: Windows Command-Line Reference: Eventcreate

这篇关于如何从命令行创建 Windows EventLog 源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆