Edit

Share via


EventLogSession.ExportLogAndMessages Method

Definition

Exports events and their messages into an external log file.

Overloads

ExportLogAndMessages(String, PathType, String, String)

Exports events and their messages into an external log file.

ExportLogAndMessages(String, PathType, String, String, Boolean, CultureInfo)

Exports events and their messages into an external log file. A flag can be set to indicate that the method will continue exporting events even if the specified query fails for some logs. The event messages are exported in the specified language.

ExportLogAndMessages(String, PathType, String, String)

Source:
EventLogSession.cs
Source:
EventLogSession.cs
Source:
EventLogSession.cs

Exports events and their messages into an external log file.

public:
 void ExportLogAndMessages(System::String ^ path, System::Diagnostics::Eventing::Reader::PathType pathType, System::String ^ query, System::String ^ targetFilePath);
public void ExportLogAndMessages (string path, System.Diagnostics.Eventing.Reader.PathType pathType, string query, string targetFilePath);
member this.ExportLogAndMessages : string * System.Diagnostics.Eventing.Reader.PathType * string * string -> unit
Public Sub ExportLogAndMessages (path As String, pathType As PathType, query As String, targetFilePath As String)

Parameters

path
String

The name of the event log to export events from, or the path to the event log file to export events from.

pathType
PathType

Specifies whether the string used in the path parameter specifies the name of an event log, or the path to an event log file.

query
String

The query used to select the events to export. Only the events returned from the query will be exported.

targetFilePath
String

The path to the log file (ends in .evtx) in which the exported events will be stored after this method is executed.

Examples

For example code using this class, see How to: Export, Archive, and Clear Event Logs.

Remarks

The event messages are exported in the default language.

See also

Applies to

ExportLogAndMessages(String, PathType, String, String, Boolean, CultureInfo)

Source:
EventLogSession.cs
Source:
EventLogSession.cs
Source:
EventLogSession.cs

Exports events and their messages into an external log file. A flag can be set to indicate that the method will continue exporting events even if the specified query fails for some logs. The event messages are exported in the specified language.

public:
 void ExportLogAndMessages(System::String ^ path, System::Diagnostics::Eventing::Reader::PathType pathType, System::String ^ query, System::String ^ targetFilePath, bool tolerateQueryErrors, System::Globalization::CultureInfo ^ targetCultureInfo);
public void ExportLogAndMessages (string path, System.Diagnostics.Eventing.Reader.PathType pathType, string query, string targetFilePath, bool tolerateQueryErrors, System.Globalization.CultureInfo targetCultureInfo);
member this.ExportLogAndMessages : string * System.Diagnostics.Eventing.Reader.PathType * string * string * bool * System.Globalization.CultureInfo -> unit
Public Sub ExportLogAndMessages (path As String, pathType As PathType, query As String, targetFilePath As String, tolerateQueryErrors As Boolean, targetCultureInfo As CultureInfo)

Parameters

path
String

The name of the event log to export events from, or the path to the event log file to export events from.

pathType
PathType

Specifies whether the string used in the path parameter specifies the name of an event log, or the path to an event log file.

query
String

The query used to select the events to export. Only the events returned from the query will be exported.

targetFilePath
String

The path to the log file (ends in .evtx) in which the exported events will be stored after this method is executed.

tolerateQueryErrors
Boolean

true indicates that the method will continue exporting events even if the specified query fails for some logs, and false indicates that this method will not continue to export events when the specified query fails.

targetCultureInfo
CultureInfo

The culture that specifies which language that the exported event messages will be in.

Examples

For example code using this class, see How to: Export, Archive, and Clear Event Logs.

See also

Applies to