-
Notifications
You must be signed in to change notification settings - Fork 0
net90_EventLogHelper_SmartEventLogger_InitializeConfiguration
Reads configuration values from App.config, Web.config, or appsettings.json (depending on the target framework) and applies them to SmartEventLogger defaults.
public static void InitializeConfiguration()This method reads predefined settings from the application's configuration and applies them to the corresponding SmartEventLogger properties. If a configuration value is not found, the property's existing value is retained.
Calling this method explicitly is optional. Configuration will also be loaded automatically the first time a public method or property is accessed, unless it has already been initialized.
Thread-safe: Initialization is guaranteed to run only once, even if called concurrently from multiple threads.
Recognized configuration keys:
Key
Description
EventLogHelper.MachineName
The name of the machine where the event log resides. Use "." for the local machine. Defaults to the current value of MachineName (normally ".").
EventLogHelper.LogName
The name of the event log to write to (e.g., "Application", "System", or a custom log). Defaults to the current value of LogName (normally "Application").
EventLogHelper.SourceName
The event source name associated with log entries. If not provided, a name is automatically generated from the calling method's namespace, class, and method name. Defaults to the current value of SourceName.
EventLogHelper.MaxKilobytes
The maximum size of the event log in kilobytes when creating a new log. Must be between 64 KB and 4 GB. If 0 or negative, the system default is used. Defaults to the current value of MaxKilobytes (normally 0).
EventLogHelper.RetentionDays
The number of days to retain event log entries when creating a new log. If 0, events are retained indefinitely. Defaults to the current value of RetentionDays (normally 0).
EventLogHelper.WriteInitEntry
Indicates whether to write an initialization entry to the log when a new log is created. Defaults to the current value of WriteInitEntry (normally True).
EventLogHelper.TruncationMarker
The string appended to messages that are truncated due to exceeding the 32,766-character limit. Defaults to the current value of TruncationMarker (normally "... [TRUNCATED]").
EventLogHelper.ContinuationMarker
The string appended to all but the last chunk of a message when multi-entry logging is enabled. Defaults to the current value of ContinuationMarker (normally " ...").
EventLogHelper.AllowMultiEntryMessages
Indicates whether messages longer than 32,766 characters should be split into multiple sequential entries instead of being truncated. Defaults to the current value of AllowMultiEntryMessages (normally False).
- class SmartEventLogger
- namespace EventLogHelper
- assembly EventLogHelper