Export (0) Print
Expand All

EventLog.LogNameFromSourceName Method

Gets the name of the log to which the specified source is registered.

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)

static member LogNameFromSourceName : 
        source:string * 
        machineName:string -> string 

Parameters

source
Type: System.String
The name of the event source.
machineName
Type: System.String
The name of the computer on which to look, or "." for the local computer.

Return Value

Type: System.String
The name of the log associated with the specified source in the registry.

The event source indicates what logs the event. It is often the name of the application, or the name of a subcomponent of the application, if the application is large. Applications and services should write to the Application log or a custom log. Device drivers should write to the System log.

When you create a new source, which can only write to one log at a time, the system registers your application with the event log as a valid source of entries. The Source property can be any string, but the name cannot be used by other sources on the computer. An attempt to create a duplicated Source value throws an exception. However, a single event log can have many different sources writing to it.

The following example deletes a source from the local computer. The example determines the log from its source, and then deletes the log.

NoteNote

More than one source might write to an event log. Before deleting a custom log, make sure there are no other sources writing to that log.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft