-
Notifications
You must be signed in to change notification settings - Fork 0
net472_EventLogHelper.Interfaces_IEventLogWriter_GetLogForSource
dparvin edited this page Sep 10, 2025
·
1 revision
Retrieves the name of the event log that a given source is registered under on the specified machine.
public string GetLogForSource(string sourceName, string machineName)| parameter | description |
|---|---|
| sourceName | The name of the event source (e.g., "MyAppSource"). This must already exist on the target machine. |
| machineName | The name of the machine to query. Use "." to indicate the local machine. |
The name of the event log (e.g., "Application", "System", or a custom log) that the specified source is registered to.
| exception | condition |
|---|---|
| ArgumentNullException | Thrown when sourceName is null or empty. |
| ApplicationException | Thrown when the log name could not be retrieved for the specified source on the given machine (e.g., due to registry corruption or insufficient access). |
This method wraps String) to provide testability and consistent error handling.
- interface IEventLogWriter
- namespace EventLogHelper.Interfaces
- assembly EventLogHelper