mscorlib(4.0.0.0) API with additions
|
Provides interaction with Windows event logs. More...
Public Member Functions | |
EventLog () | |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Does not associate the instance with any log. More... | |
EventLog (string logName) | |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Associates the instance with a log on the local computer. More... | |
EventLog (string logName, string machineName) | |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Associates the instance with a log on the specified computer. More... | |
EventLog (string logName, string machineName, string source) | |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Associates the instance with a log on the specified computer and creates or assigns the specified source to the T:System.Diagnostics.EventLog. More... | |
void | BeginInit () |
Begins the initialization of an T:System.Diagnostics.EventLog used on a form or used by another component. The initialization occurs at runtime. More... | |
void | Clear () |
Removes all entries from the event log. More... | |
void | Close () |
Closes the event log and releases read and write handles. More... | |
void | EndInit () |
Ends the initialization of an T:System.Diagnostics.EventLog used on a form or by another component. The initialization occurs at runtime. More... | |
void | ModifyOverflowPolicy (OverflowAction action, int retentionDays) |
Changes the configured behavior for writing new entries when the event log reaches its maximum file size. More... | |
void | RegisterDisplayName (string resourceFile, long resourceId) |
Specifies the localized name of the event log, which is displayed in the server Event Viewer. More... | |
void | WriteEntry (string message) |
Writes an information type entry, with the given message text, to the event log. More... | |
void | WriteEntry (string message, EventLogEntryType type) |
Writes an error, warning, information, success audit, or failure audit entry with the given message text to the event log. More... | |
void | WriteEntry (string message, EventLogEntryType type, int eventID) |
Writes an entry with the given message text and application-defined event identifier to the event log. More... | |
void | WriteEntry (string message, EventLogEntryType type, int eventID, short category) |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log. More... | |
void | WriteEntry (string message, EventLogEntryType type, int eventID, short category, byte[] rawData) |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log, and appends binary data to the message. More... | |
void | WriteEvent (EventInstance instance, params object[] values) |
Writes a localized entry to the event log. More... | |
void | WriteEvent (EventInstance instance, byte[] data, params object[] values) |
Writes an event log entry with the given event data, message replacement strings, and associated binary data. More... | |
![]() | |
void | Dispose () |
Releases all resources used by the T:System.ComponentModel.Component. More... | |
override string | ToString () |
Returns a T:System.String containing the name of the T:System.ComponentModel.Component, if any. This method should not be overridden. More... | |
![]() | |
object | GetLifetimeService () |
Retrieves the current lifetime service object that controls the lifetime policy for this instance. More... | |
virtual object | InitializeLifetimeService () |
Obtains a lifetime service object to control the lifetime policy for this instance. More... | |
virtual ObjRef | CreateObjRef (Type requestedType) |
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. More... | |
Static Public Member Functions | |
static void | CreateEventSource (string source, string logName) |
Establishes the specified source name as a valid event source for writing entries to a log on the local computer. This method can also create a new custom log on the local computer. More... | |
static void | CreateEventSource (string source, string logName, string machineName) |
Establishes the specified source name as a valid event source for writing entries to a log on the specified computer. This method can also be used to create a new custom log on the specified computer. More... | |
static void | CreateEventSource (EventSourceCreationData sourceData) |
Establishes a valid event source for writing localized event messages, using the specified configuration properties for the event source and the corresponding event log. More... | |
static void | Delete (string logName) |
Removes an event log from the local computer. More... | |
static void | Delete (string logName, string machineName) |
Removes an event log from the specified computer. More... | |
static void | DeleteEventSource (string source) |
Removes the event source registration from the event log of the local computer. More... | |
static void | DeleteEventSource (string source, string machineName) |
Removes the application's event source registration from the specified computer. More... | |
static bool | Exists (string logName) |
Determines whether the log exists on the local computer. More... | |
static bool | Exists (string logName, string machineName) |
Determines whether the log exists on the specified computer. More... | |
static EventLog [] | GetEventLogs () |
Searches for all event logs on the local computer and creates an array of T:System.Diagnostics.EventLog objects that contain the list. More... | |
static EventLog [] | GetEventLogs (string machineName) |
Searches for all event logs on the given computer and creates an array of T:System.Diagnostics.EventLog objects that contain the list. More... | |
static bool | SourceExists (string source) |
Determines whether an event source is registered on the local computer. More... | |
static bool | SourceExists (string source, string machineName) |
Determines whether an event source is registered on a specified computer. More... | |
static string | LogNameFromSourceName (string source, string machineName) |
Gets the name of the log to which the specified source is registered. More... | |
static void | WriteEntry (string source, string message) |
Writes an information type entry with the given message text to the event log, using the specified registered event source. More... | |
static void | WriteEntry (string source, string message, EventLogEntryType type) |
Writes an error, warning, information, success audit, or failure audit entry with the given message text to the event log, using the specified registered event source. More... | |
static void | WriteEntry (string source, string message, EventLogEntryType type, int eventID) |
Writes an entry with the given message text and application-defined event identifier to the event log, using the specified registered event source. More... | |
static void | WriteEntry (string source, string message, EventLogEntryType type, int eventID, short category) |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log, using the specified registered event source. The category can be used by the Event Viewer to filter events in the log. More... | |
static void | WriteEntry (string source, string message, EventLogEntryType type, int eventID, short category, byte[] rawData) |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log (using the specified registered event source) and appends binary data to the message. More... | |
static void | WriteEvent (string source, EventInstance instance, params object[] values) |
Writes an event log entry with the given event data and message replacement strings, using the specified registered event source. More... | |
static void | WriteEvent (string source, EventInstance instance, byte[] data, params object[] values) |
Writes an event log entry with the given event data, message replacement strings, and associated binary data, and using the specified registered event source. More... | |
Protected Member Functions | |
override void | Dispose (bool disposing) |
Releases the unmanaged resources used by the T:System.Diagnostics.EventLog, and optionally releases the managed resources. More... | |
![]() | |
virtual object | GetService (Type service) |
Returns an object that represents a service provided by the T:System.ComponentModel.Component or by its T:System.ComponentModel.Container. More... | |
![]() | |
MarshalByRefObject | MemberwiseClone (bool cloneIdentity) |
Creates a shallow copy of the current T:System.MarshalByRefObject object. More... | |
Properties | |
EventLogEntryCollection | Entries [get] |
Gets the contents of the event log. More... | |
string | LogDisplayName [get] |
Gets the event log's friendly name. More... | |
string | Log [get, set] |
Gets or sets the name of the log to read from or write to. More... | |
string | MachineName [get, set] |
Gets or sets the name of the computer on which to read or write events. More... | |
long | MaximumKilobytes [get, set] |
Gets or sets the maximum event log size in kilobytes. More... | |
OverflowAction | OverflowAction [get] |
Gets the configured behavior for storing new entries when the event log reaches its maximum log file size. More... | |
int | MinimumRetentionDays [get] |
Gets the number of days to retain entries in the event log. More... | |
bool | EnableRaisingEvents [get, set] |
Gets or sets a value indicating whether the T:System.Diagnostics.EventLog receives E:System.Diagnostics.EventLog.EntryWritten event notifications. More... | |
ISynchronizeInvoke | SynchronizingObject [get, set] |
Gets or sets the object used to marshal the event handler calls issued as a result of an T:System.Diagnostics.EventLog entry written event. More... | |
string | Source [get, set] |
Gets or sets the source name to register and use when writing to the event log. More... | |
EntryWrittenEventHandler | EntryWritten |
Occurs when an entry is written to an event log on the local computer. More... | |
![]() | |
EventHandlerList | Events [get] |
Gets the list of event handlers that are attached to this T:System.ComponentModel.Component. More... | |
virtual ISite | Site [get, set] |
Gets or sets the T:System.ComponentModel.ISite of the T:System.ComponentModel.Component. More... | |
IContainer? | Container [get] |
Gets the T:System.ComponentModel.IContainer that contains the T:System.ComponentModel.Component. More... | |
bool??? | DesignMode [get] |
Gets a value that indicates whether the T:System.ComponentModel.Component is currently in design mode. More... | |
EventHandler | Disposed |
Occurs when the component is disposed by a call to the M:System.ComponentModel.Component.Dispose method. More... | |
![]() | |
ISite | Site [get, set] |
Gets or sets the T:System.ComponentModel.ISite associated with the T:System.ComponentModel.IComponent. More... | |
Additional Inherited Members | |
![]() | |
virtual bool | CanRaiseEvents => true |
Gets a value indicating whether the component can raise an event. More... | |
![]() | |
EventHandler | Disposed |
Represents the method that handles the E:System.ComponentModel.IComponent.Disposed event of a component. More... | |
Provides interaction with Windows event logs.
Definition at line 20 of file EventLog.cs.
System.Diagnostics.EventLog.EventLog | ( | ) |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Does not associate the instance with any log.
Definition at line 273 of file EventLog.cs.
System.Diagnostics.EventLog.EventLog | ( | string | logName | ) |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Associates the instance with a log on the local computer.
logName | The name of the log on the local computer. |
T:System.ArgumentNullException | The log name is null . |
T:System.ArgumentException | The log name is invalid. |
Definition at line 282 of file EventLog.cs.
System.Diagnostics.EventLog.EventLog | ( | string | logName, |
string | machineName | ||
) |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Associates the instance with a log on the specified computer.
logName | The name of the log on the specified computer. |
machineName | The computer on which the log exists. |
T:System.ArgumentNullException | The log name is null . |
T:System.ArgumentException | The log name is invalid.-or- The computer name is invalid. |
Definition at line 292 of file EventLog.cs.
System.Diagnostics.EventLog.EventLog | ( | string | logName, |
string | machineName, | ||
string | source | ||
) |
Initializes a new instance of the T:System.Diagnostics.EventLog class. Associates the instance with a log on the specified computer and creates or assigns the specified source to the T:System.Diagnostics.EventLog.
logName | The name of the log on the specified computer |
machineName | The computer on which the log exists. |
source | The source of event log entries. |
T:System.ArgumentNullException | The log name is null . |
T:System.ArgumentException | The log name is invalid.-or- The computer name is invalid. |
Definition at line 303 of file EventLog.cs.
void System.Diagnostics.EventLog.BeginInit | ( | ) |
Begins the initialization of an T:System.Diagnostics.EventLog used on a form or used by another component. The initialization occurs at runtime.
T:System.InvalidOperationException | T:System.Diagnostics.EventLog is already initialized. |
Implements System.ComponentModel.ISupportInitialize.
Definition at line 316 of file EventLog.cs.
void System.Diagnostics.EventLog.Clear | ( | ) |
Removes all entries from the event log.
T:System.ComponentModel.Win32Exception | The event log was not cleared successfully.-or- The log cannot be opened. A Windows error code is not available. |
T:System.ArgumentException | A value is not specified for the P:System.Diagnostics.EventLog.Log property. Make sure the log name is not an empty string. |
T:System.InvalidOperationException | The log does not exist. |
Definition at line 325 of file EventLog.cs.
void System.Diagnostics.EventLog.Close | ( | ) |
Closes the event log and releases read and write handles.
T:System.ComponentModel.Win32Exception | The event log's read handle or write handle was not released successfully. |
Definition at line 332 of file EventLog.cs.
|
static |
Establishes the specified source name as a valid event source for writing entries to a log on the local computer. This method can also create a new custom log on the local computer.
source | The source name by which the application is registered on the local computer. |
logName | The name of the log the source's entries are written to. Possible values include Application, System, or a custom event log. |
T:System.ArgumentException | source is an empty string ("") or null .- or - logName is not a valid event log name. Event log names must consist of printable characters, and cannot include the characters '*', '?', or '\'.- or - logName is not valid for user log creation. The event log names AppEvent, SysEvent, and SecEvent are reserved for system use.- or - The log name matches an existing event source name.- or - The source name results in a registry key path longer than 254 characters.- or - The first 8 characters of logName match the first 8 characters of an existing event log name.- or - The source cannot be registered because it already exists on the local computer.- or - The source name matches an existing event log name. |
T:System.InvalidOperationException | The registry key for the event log could not be opened on the local computer. |
Definition at line 345 of file EventLog.cs.
|
static |
Establishes the specified source name as a valid event source for writing entries to a log on the specified computer. This method can also be used to create a new custom log on the specified computer.
source | The source by which the application is registered on the specified computer. |
logName | The name of the log the source's entries are written to. Possible values include Application, System, or a custom event log. If you do not specify a value, logName defaults to Application. |
machineName | The name of the computer to register this event source with, or "." for the local computer. |
T:System.ArgumentException | The machineName is not a valid computer name.- or - source is an empty string ("") or null .- or - logName is not a valid event log name. Event log names must consist of printable characters, and cannot include the characters '*', '?', or '\'.- or - logName is not valid for user log creation. The event log names AppEvent, SysEvent, and SecEvent are reserved for system use.- or - The log name matches an existing event source name.- or - The source name results in a registry key path longer than 254 characters.- or - The first 8 characters of logName match the first 8 characters of an existing event log name on the specified computer.- or - The source cannot be registered because it already exists on the specified computer.- or - The source name matches an existing event source name. |
T:System.InvalidOperationException | The registry key for the event log could not be opened on the specified computer. |
Definition at line 360 of file EventLog.cs.
|
static |
Establishes a valid event source for writing localized event messages, using the specified configuration properties for the event source and the corresponding event log.
sourceData | The configuration properties for the event source and its target event log. |
T:System.ArgumentException | The computer name specified in sourceData is not valid.- or - The source name specified in sourceData is null .- or - The log name specified in sourceData is not valid. Event log names must consist of printable characters and cannot include the characters '*', '?', or '\'.- or - The log name specified in sourceData is not valid for user log creation. The Event log names AppEvent, SysEvent, and SecEvent are reserved for system use.- or - The log name matches an existing event source name.- or - The source name specified in sourceData results in a registry key path longer than 254 characters.- or - The first 8 characters of the log name specified in sourceData are not unique.- or - The source name specified in sourceData is already registered.- or - The source name specified in sourceData matches an existing event log name. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ArgumentNullException | sourceData is null . |
Definition at line 371 of file EventLog.cs.
|
static |
Removes an event log from the local computer.
logName | The name of the log to delete. Possible values include: Application, Security, System, and any custom event logs on the computer. |
T:System.ArgumentException | logName is an empty string ("") or null . |
T:System.InvalidOperationException | The registry key for the event log could not be opened on the local computer.- or - The log does not exist on the local computer. |
T:System.ComponentModel.Win32Exception | The event log was not cleared successfully.-or- The log cannot be opened. A Windows error code is not available. |
Definition at line 539 of file EventLog.cs.
|
static |
Removes an event log from the specified computer.
logName | The name of the log to delete. Possible values include: Application, Security, System, and any custom event logs on the specified computer. |
machineName | The name of the computer to delete the log from, or "." for the local computer. |
T:System.ArgumentException | logName is an empty string ("") or null . - or - machineName is not a valid computer name. |
T:System.InvalidOperationException | The registry key for the event log could not be opened on the specified computer.- or - The log does not exist on the specified computer. |
T:System.ComponentModel.Win32Exception | The event log was not cleared successfully.-or- The log cannot be opened. A Windows error code is not available. |
Definition at line 552 of file EventLog.cs.
|
static |
Removes the event source registration from the event log of the local computer.
source | The name by which the application is registered in the event log system. |
T:System.ArgumentException | The source parameter does not exist in the registry of the local computer.- or - You do not have write access on the registry key for the event log. |
Definition at line 635 of file EventLog.cs.
|
static |
Removes the application's event source registration from the specified computer.
source | The name by which the application is registered in the event log system. |
machineName | The name of the computer to remove the registration from, or "." for the local computer. |
T:System.ArgumentException | The machineName parameter is invalid. - or - The source parameter does not exist in the registry of the specified computer.- or - You do not have write access on the registry key for the event log. |
T:System.InvalidOperationException | source cannot be deleted because in the registry, the parent registry key for source does not contain a subkey with the same name. |
Definition at line 646 of file EventLog.cs.
|
protectedvirtual |
Releases the unmanaged resources used by the T:System.Diagnostics.EventLog, and optionally releases the managed resources.
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Reimplemented from System.ComponentModel.Component.
Definition at line 719 of file EventLog.cs.
void System.Diagnostics.EventLog.EndInit | ( | ) |
Ends the initialization of an T:System.Diagnostics.EventLog used on a form or by another component. The initialization occurs at runtime.
Implements System.ComponentModel.ISupportInitialize.
Definition at line 729 of file EventLog.cs.
|
static |
Determines whether the log exists on the local computer.
logName | The name of the log to search for. Possible values include: Application, Security, System, other application-specific logs (such as those associated with Active Directory), or any custom log on the computer. |
true
if the log exists on the local computer; otherwise, false
.T:System.ArgumentException | The logName is null or the value is empty. |
Definition at line 739 of file EventLog.cs.
|
static |
Determines whether the log exists on the specified computer.
logName | The log for which to search. Possible values include: Application, Security, System, other application-specific logs (such as those associated with Active Directory), or any custom log on the computer. |
machineName | The name of the computer on which to search for the log, or "." for the local computer. |
true
if the log exists on the specified computer; otherwise, false
.T:System.ArgumentException | The machineName parameter is an invalid format. Make sure you have used proper syntax for the computer on which you are searching.-or- The logName is null or the value is empty. |
Definition at line 750 of file EventLog.cs.
|
static |
Searches for all event logs on the local computer and creates an array of T:System.Diagnostics.EventLog objects that contain the list.
T:System.SystemException | You do not have read access to the registry.-or- There is no event log service on the computer. |
Definition at line 883 of file EventLog.cs.
|
static |
Searches for all event logs on the given computer and creates an array of T:System.Diagnostics.EventLog objects that contain the list.
machineName | The computer on which to search for event logs. |
T:System.ArgumentException | The machineName parameter is an invalid computer name. |
T:System.InvalidOperationException | You do not have read access to the registry.-or- There is no event log service on the computer. |
Definition at line 893 of file EventLog.cs.
|
static |
Gets the name of the log to which the specified source is registered.
source | The name of the event source. |
machineName | The name of the computer on which to look, or "." for the local computer. |
Definition at line 994 of file EventLog.cs.
void System.Diagnostics.EventLog.ModifyOverflowPolicy | ( | OverflowAction | action, |
int | retentionDays | ||
) |
Changes the configured behavior for writing new entries when the event log reaches its maximum file size.
action | The overflow behavior for writing new entries to the event log. |
retentionDays | The minimum number of days each event log entry is retained. This parameter is used only if action is set to F:System.Diagnostics.OverflowAction.OverwriteOlder. |
T:System.ComponentModel.InvalidEnumArgumentException | action is not a valid P:System.Diagnostics.EventLog.OverflowAction value. |
T:System.ArgumentOutOfRangeException | retentionDays is less than one, or larger than 365. |
T:System.InvalidOperationException | The P:System.Diagnostics.EventLog.Log value is not a valid log name.- or -The registry key for the event log could not be opened on the target computer. |
Definition at line 1024 of file EventLog.cs.
void System.Diagnostics.EventLog.RegisterDisplayName | ( | string | resourceFile, |
long | resourceId | ||
) |
Specifies the localized name of the event log, which is displayed in the server Event Viewer.
resourceFile | The fully specified path to a localized resource file. |
resourceId | The resource identifier that indexes a localized string within the resource file. |
T:System.InvalidOperationException | The P:System.Diagnostics.EventLog.Log value is not a valid log name.- or -The registry key for the event log could not be opened on the target computer. |
T:System.ArgumentNullException | resourceFile is null . |
Definition at line 1036 of file EventLog.cs.
|
static |
Determines whether an event source is registered on the local computer.
source | The name of the event source. |
true
if the event source is registered on the local computer; otherwise, false
.T:System.Security.SecurityException | source was not found, but some or all of the event logs could not be searched. |
Definition at line 957 of file EventLog.cs.
|
static |
Determines whether an event source is registered on a specified computer.
source | The name of the event source. |
machineName | The name the computer on which to look, or "." for the local computer. |
true
if the event source is registered on the given computer; otherwise, false
.T:System.ArgumentException | machineName is an invalid computer name. |
T:System.Security.SecurityException | source was not found, but some or all of the event logs could not be searched. |
Definition at line 971 of file EventLog.cs.
void System.Diagnostics.EventLog.WriteEntry | ( | string | message | ) |
Writes an information type entry, with the given message text, to the event log.
message | The string to write to the event log. |
T:System.ArgumentException | The P:System.Diagnostics.EventLog.Source property of the T:System.Diagnostics.EventLog has not been set.-or- The method attempted to register a new event source, but the computer name in P:System.Diagnostics.EventLog.MachineName is not valid.- or -The source is already registered for a different event log.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1232 of file EventLog.cs.
|
static |
Writes an information type entry with the given message text to the event log, using the specified registered event source.
source | The source by which the application is registered on the specified computer. |
message | The string to write to the event log. |
T:System.ArgumentException | The source value is an empty string ("").- or -The source value is null .- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1243 of file EventLog.cs.
void System.Diagnostics.EventLog.WriteEntry | ( | string | message, |
EventLogEntryType | type | ||
) |
Writes an error, warning, information, success audit, or failure audit entry with the given message text to the event log.
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
T:System.ArgumentException | The P:System.Diagnostics.EventLog.Source property of the T:System.Diagnostics.EventLog has not been set.-or- The method attempted to register a new event source, but the computer name in P:System.Diagnostics.EventLog.MachineName is not valid.- or -The source is already registered for a different event log.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1256 of file EventLog.cs.
|
static |
Writes an error, warning, information, success audit, or failure audit entry with the given message text to the event log, using the specified registered event source.
source | The source by which the application is registered on the specified computer. |
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
T:System.ArgumentException | The source value is an empty string ("").- or -The source value is null .- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1270 of file EventLog.cs.
void System.Diagnostics.EventLog.WriteEntry | ( | string | message, |
EventLogEntryType | type, | ||
int | eventID | ||
) |
Writes an entry with the given message text and application-defined event identifier to the event log.
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
eventID | The application-specific identifier for the event. |
T:System.ArgumentException | The P:System.Diagnostics.EventLog.Source property of the T:System.Diagnostics.EventLog has not been set.-or- The method attempted to register a new event source, but the computer name in P:System.Diagnostics.EventLog.MachineName is not valid.- or -The source is already registered for a different event log.- or - eventID is less than zero or greater than F:System.UInt16.MaxValue.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1285 of file EventLog.cs.
|
static |
Writes an entry with the given message text and application-defined event identifier to the event log, using the specified registered event source.
source | The source by which the application is registered on the specified computer. |
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
eventID | The application-specific identifier for the event. |
T:System.ArgumentException | The source value is an empty string ("").- or -The source value is null .- or - eventID is less than zero or greater than F:System.UInt16.MaxValue.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1301 of file EventLog.cs.
void System.Diagnostics.EventLog.WriteEntry | ( | string | message, |
EventLogEntryType | type, | ||
int | eventID, | ||
short | category | ||
) |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log.
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
eventID | The application-specific identifier for the event. |
category | The application-specific subcategory associated with the message. |
T:System.ArgumentException | The P:System.Diagnostics.EventLog.Source property of the T:System.Diagnostics.EventLog has not been set.-or- The method attempted to register a new event source, but the computer name in P:System.Diagnostics.EventLog.MachineName is not valid.- or -The source is already registered for a different event log.- or - eventID is less than zero or greater than F:System.UInt16.MaxValue.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1317 of file EventLog.cs.
|
static |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log, using the specified registered event source. The category can be used by the Event Viewer to filter events in the log.
source | The source by which the application is registered on the specified computer. |
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
eventID | The application-specific identifier for the event. |
category | The application-specific subcategory associated with the message. |
T:System.ArgumentException | The source value is an empty string ("").- or -The source value is null .- or - eventID is less than zero or greater than F:System.UInt16.MaxValue.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1334 of file EventLog.cs.
|
static |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log (using the specified registered event source) and appends binary data to the message.
source | The source by which the application is registered on the specified computer. |
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
eventID | The application-specific identifier for the event. |
category | The application-specific subcategory associated with the message. |
rawData | An array of bytes that holds the binary data associated with the entry. |
T:System.ArgumentException | The source value is an empty string ("").- or -The source value is null .- or - eventID is less than zero or greater than F:System.UInt16.MaxValue.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1352 of file EventLog.cs.
void System.Diagnostics.EventLog.WriteEntry | ( | string | message, |
EventLogEntryType | type, | ||
int | eventID, | ||
short | category, | ||
byte [] | rawData | ||
) |
Writes an entry with the given message text, application-defined event identifier, and application-defined category to the event log, and appends binary data to the message.
message | The string to write to the event log. |
type | One of the T:System.Diagnostics.EventLogEntryType values. |
eventID | The application-specific identifier for the event. |
category | The application-specific subcategory associated with the message. |
rawData | An array of bytes that holds the binary data associated with the entry. |
T:System.ArgumentException | The P:System.Diagnostics.EventLog.Source property of the T:System.Diagnostics.EventLog has not been set.-or- The method attempted to register a new event source, but the computer name in P:System.Diagnostics.EventLog.MachineName is not valid.- or -The source is already registered for a different event log.- or - eventID is less than zero or greater than F:System.UInt16.MaxValue.- or -The message string is longer than 31,839 bytes (32,766 bytes on Windows operating systems before Windows Vista).- or -The source name results in a registry key path longer than 254 characters. |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.InvalidEnumArgumentException | type is not a valid T:System.Diagnostics.EventLogEntryType. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1372 of file EventLog.cs.
void System.Diagnostics.EventLog.WriteEvent | ( | EventInstance | instance, |
params object [] | values | ||
) |
Writes a localized entry to the event log.
instance | An T:System.Diagnostics.EventInstance instance that represents a localized event log entry. |
values | An array of strings to merge into the message text of the event log entry. |
T:System.ArgumentException | The P:System.Diagnostics.EventLog.Source property of the T:System.Diagnostics.EventLog has not been set.-or- The method attempted to register a new event source, but the computer name in P:System.Diagnostics.EventLog.MachineName is not valid.- or -The source is already registered for a different event log.- or - instance.InstanceId is less than zero or greater than F:System.UInt16.MaxValue.- or - values has more than 256 elements.- or -One of the values elements is longer than 32766 bytes.- or -The source name results in a registry key path longer than 254 characters. |
T:System.ArgumentNullException | instance is null . |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1388 of file EventLog.cs.
void System.Diagnostics.EventLog.WriteEvent | ( | EventInstance | instance, |
byte [] | data, | ||
params object [] | values | ||
) |
Writes an event log entry with the given event data, message replacement strings, and associated binary data.
instance | An T:System.Diagnostics.EventInstance instance that represents a localized event log entry. |
data | An array of bytes that holds the binary data associated with the entry. |
values | An array of strings to merge into the message text of the event log entry. |
T:System.ArgumentException | The P:System.Diagnostics.EventLog.Source property of the T:System.Diagnostics.EventLog has not been set.-or- The method attempted to register a new event source, but the computer name in P:System.Diagnostics.EventLog.MachineName is not valid.- or -The source is already registered for a different event log.- or - instance.InstanceId is less than zero or greater than F:System.UInt16.MaxValue.- or - values has more than 256 elements.- or -One of the values elements is longer than 32766 bytes.- or -The source name results in a registry key path longer than 254 characters. |
T:System.ArgumentNullException | instance is null . |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1405 of file EventLog.cs.
|
static |
Writes an event log entry with the given event data and message replacement strings, using the specified registered event source.
source | The name of the event source registered for the application on the specified computer. |
instance | An T:System.Diagnostics.EventInstance instance that represents a localized event log entry. |
values | An array of strings to merge into the message text of the event log entry. |
T:System.ArgumentException | The source value is an empty string ("").- or -The source value is null .- or - instance.InstanceId is less than zero or greater than F:System.UInt16.MaxValue.- or - values has more than 256 elements.- or -One of the values elements is longer than 32766 bytes.- or -The source name results in a registry key path longer than 254 characters. |
T:System.ArgumentNullException | instance is null . |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1421 of file EventLog.cs.
|
static |
Writes an event log entry with the given event data, message replacement strings, and associated binary data, and using the specified registered event source.
source | The name of the event source registered for the application on the specified computer. |
instance | An T:System.Diagnostics.EventInstance instance that represents a localized event log entry. |
data | An array of bytes that holds the binary data associated with the entry. |
values | An array of strings to merge into the message text of the event log entry. |
T:System.ArgumentException | The source value is an empty string ("").- or -The source value is null .- or - instance.InstanceId is less than zero or greater than F:System.UInt16.MaxValue.- or - values has more than 256 elements.- or -One of the values elements is longer than 32766 bytes.- or -The source name results in a registry key path longer than 254 characters. |
T:System.ArgumentNullException | instance is null . |
T:System.InvalidOperationException | The registry key for the event log could not be opened. |
T:System.ComponentModel.Win32Exception | The operating system reported an error when writing the event entry to the event log. A Windows error code is not available. |
Definition at line 1441 of file EventLog.cs.
|
getset |
Gets or sets a value indicating whether the T:System.Diagnostics.EventLog receives E:System.Diagnostics.EventLog.EntryWritten event notifications.
true
if the T:System.Diagnostics.EventLog receives notification when an entry is written to the log; otherwise, false
.T:System.InvalidOperationException | The event log is on a remote computer. |
Definition at line 188 of file EventLog.cs.
|
get |
Gets the contents of the event log.
Definition at line 60 of file EventLog.cs.
|
addremove |
Occurs when an entry is written to an event log on the local computer.
Definition at line 249 of file EventLog.cs.
|
getset |
Gets or sets the name of the log to read from or write to.
Definition at line 87 of file EventLog.cs.
|
get |
Gets the event log's friendly name.
T:System.InvalidOperationException | The specified P:System.Diagnostics.EventLog.Log does not exist in the registry for this computer. |
Definition at line 72 of file EventLog.cs.
|
getset |
Gets or sets the name of the computer on which to read or write events.
T:System.ArgumentException | The computer name is invalid. |
Definition at line 115 of file EventLog.cs.
|
getset |
Gets or sets the maximum event log size in kilobytes.
T:System.ArgumentOutOfRangeException | The specified value is less than 64, or greater than 4194240, or not an even multiple of 64. |
T:System.InvalidOperationException | The P:System.Diagnostics.EventLog.Log value is not a valid log name.- or -The registry key for the event log could not be opened on the target computer. |
Definition at line 143 of file EventLog.cs.
|
get |
Gets the number of days to retain entries in the event log.
Definition at line 171 of file EventLog.cs.
|
get |
Gets the configured behavior for storing new entries when the event log reaches its maximum log file size.
Definition at line 159 of file EventLog.cs.
|
getset |
Gets or sets the source name to register and use when writing to the event log.
T:System.ArgumentException | The source name results in a registry key path longer than 254 characters. |
Definition at line 226 of file EventLog.cs.
|
getset |
Gets or sets the object used to marshal the event handler calls issued as a result of an T:System.Diagnostics.EventLog entry written event.
Definition at line 205 of file EventLog.cs.