Skip to content

net472_EventLogHelper_SmartEventLogger_GetLog

dparvin edited this page Aug 11, 2025 · 2 revisions

SmartEventLogger.GetLog method (1 of 6)

Gets the entry log class to use for writing to the event log.

public static EventLog GetLog()

See Also


SmartEventLogger.GetLog method (2 of 6)

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.

See Also


SmartEventLogger.GetLog method (3 of 6)

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.

See Also


SmartEventLogger.GetLog method (4 of 6)

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.

See Also


SmartEventLogger.GetLog method (5 of 6)

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.

See Also


SmartEventLogger.GetLog method (6 of 6)

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.

See Also

Clone this wiki locally