Delphi: 使用子键记录到事件查看器

huangapple go评论77阅读模式
英文:

Delphi: Log to Eventviewer using subkeys

问题

我多年来一直在思考的一件事...希望有人能提供一些启发。

如果你查看Windows事件查看器中的日志应用程序和服务,你会看到一些是使用一个带有子键的键入文件夹的条目。

就像在我的情况下有'Intel','Microsoft'和'OpenSSH'一样。

Delphi: 使用子键记录到事件查看器

在我的当前系统中,我正在记录到事件查看器中的一个自己的键,但我的所有服务和应用程序都记录到同一个条目中。
我希望我可以有一个以公司名称命名的键(就像示例中的'OpenSSH'一样),并为每个记录到事件查看器的应用程序创建子键。

像这样:
日志应用程序和服务
公司名称
应用程序1
服务1
应用程序2
我已经阅读了很多页面上的信息,但无法弄清楚如何实现这一点。
我知道当前系统是在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog注册表键中使用'EventMessageFile'和'TypesSupported'值来创建键和子键,但我无法弄清楚如何处理子键。

英文:

one of the things i have been wondering for years...i hope someone can shed a light.

If you look at Logs applications and services in Windows eventviewer you will see some are using a key a folder type entry with subkeys.

Like 'Intel', 'Microsoft' and 'OpenSSH' in my case.

Delphi: 使用子键记录到事件查看器

In my current system in am logging to eventviewer in a own key but all my services and applications log to that same entry.
I would prefer that i have a key with the name of the company (like 'OpenSSH' in the example) and subkeys for each of the applications that log to eventviewer.

Like
Logs Applications and services
CompanyName
Application1
Service1
Application2
I have read many many pages with info but can't figure out how this can be done
i know the current system is to have keys and subkeys in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog registrykey with 'EventMessageFile' and 'TypesSupported' values but i can't figure how to handle the subkeys.

答案1

得分: 1

终于找到了如何创建事件查看器键的方法,这个链接中的C#示例有效:https://stackoverflow.com/questions/36567648/creating-an-eventlog-in-a-folder,它基于 https://stackoverflow.com/questions/26335960/create-event-log-in-sub-directory-under-applications-and-settings-logs

我成功地创建了一个Delphi应用程序,它可以创建相同的注册表键和所需的数值。

现在我将尝试找到一个可以记录到这些“通道”的ReportEvent/LogMessage函数。

英文:

Finally found how to create the eventviewer keys, the C# example in this link works https://stackoverflow.com/questions/36567648/creating-an-eventlog-in-a-folder , which was based on https://stackoverflow.com/questions/26335960/create-event-log-in-sub-directory-under-applications-and-settings-logs

I managed to create a Delphi app that creates the same registry keys and the needed values now.
Now i'm going to try and find a ReportEvent/LogMessage function that can log to these 'channels'

huangapple
  • 本文由 发表于 2023年8月10日 21:36:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76876263.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定