-
Notifications
You must be signed in to change notification settings - Fork 0
net472_EventLogHelper_SmartEventLogger_GetLog
dparvin edited this page Aug 11, 2025
·
2 revisions
Gets the entry log class to use for writing to the event log.
public static EventLog GetLog()- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Gets the entry log class to use for writing to the event log.
public static EventLog GetLog(string sourceName)| parameter | description |
|---|---|
| sourceName | The source name to associate with the event log entry. If null or empty, a source is automatically generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Gets the entry log class to use for writing to the event log.
public static EventLog GetLog(string logName, string sourceName)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, the value of the static LogName property is used. |
| sourceName | The source name to associate with the event log entry. If null or empty, a source is automatically generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Gets the entry log class to use for writing to the event log.
public static EventLog GetLog(string logName, string sourceName, int maxKilobytes,
int retentionDays)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, the value of the static LogName property is used. |
| sourceName | The source name to associate with the event log entry. If null or empty, a source is automatically generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Gets the entry log class to use for writing to the event log.
public static EventLog GetLog(string logName, string sourceName, int maxKilobytes,
int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, the value of the static LogName property is used. |
| sourceName | The source name to associate with the event log entry. If null or empty, a source is automatically generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper
Gets the entry log class to use for writing to the event log.
public static EventLog GetLog(string machineName, string logName, string sourceName,
int maxKilobytes, int retentionDays, bool writeInitEntry)| parameter | description |
|---|---|
| machineName | The name of the machine where the event log resides. Use "." to refer to the local machine. If null or empty, the local machine is used by default, or the value in MachinName if set. |
| logName | The name of the event log to write to (e.g., "Application", "System", or a custom log name). If null or empty, the value of the static LogName property is used. |
| sourceName | The source name to associate with the event log entry. If null or empty, a source is automatically generated using the calling method's namespace, class, and method name. If the source exceeds 254 characters, it is automatically truncated. |
| maxKilobytes | The maximum size of the event log in kilobytes. Only used when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. |
| retentionDays | The number of days to retain event log entries. If 0, events are retained indefinitely. Only used when creating a new log. |
| writeInitEntry | Indicates whether an initialization entry should be written when a new log is created. |
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper