I've searched and searched and can't find the answer. We have a custom service that runs and logs into the Event Viewer. In Windows 7, there's a folder called "Applications and Services Logs". How do I log an event in there? Is it even possible?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
It will happen automatically when you create a new Event Log using something like:
And that call requires elevated privileges, but only needs to be done once. After that, you can reference with normal privileges using.
Note: If you are moving your source from
Application
to your custom log, it may need some tweaking and/or a reboot as it is not normal to move a source from one log to another.If you are using InstalUtil, you can also create the log using a
System.Diagnostics.EventLogInstaller