EventLogTraceListener クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EventLogTraceListener クラスの意味・解説 

EventLogTraceListener クラス

トレース出力またはデバッグ出力を EventLog に転送する簡単なリスナ提供します

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Public NotInheritable Class
 EventLogTraceListener
    Inherits TraceListener
Dim instance As EventLogTraceListener
public sealed class EventLogTraceListener :
 TraceListener
public ref class EventLogTraceListener sealed
 : public TraceListener
public final class EventLogTraceListener extends
 TraceListener
public final class EventLogTraceListener extends
 TraceListener
解説解説
メモメモ

このクラス適用される HostProtectionAttribute 属性Resources プロパティの値は、Synchronization です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的にはアイコンダブルクリックコマンド入力、またはブラウザURL入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラストピックまたは「SQL Server プログラミングホスト保護属性」を参照してください

トレース出力またはデバッグ出力EventLogリダイレクトするために、この EventLogTraceListenerインスタンスを Debug.Listeners コレクションまたは Trace.Listeners コレクション追加できます

このクラスは、トレース出力またはデバッグ出力受信するイベント ログ取得または設定するための EventLog プロパティと、EventLogTraceListener の名前を保持するための Name プロパティ提供します

Close メソッドは、イベント ログ終了してトレース出力またはデバッグ出力受信しないようにします。メッセージは、Write メソッドおよび WriteLine メソッドによってイベント ログ書き込まれます。

メモメモ

大量データイベント ログ書き込まれないようにするために、EventLogTraceListener は TraceOutputOptions プロパティによって指定されオプショントレース データ出力しません。

使用例使用例

イベント ログ出力するトレース リスナ作成する例を次に示します。まず、myEventLog というイベント ログ作成されます。次にmyEventLog使用する新しEventLogTraceListener作成されます。さらに、myTraceListenerTrace.Listeners コレクション追加されます。最後に、行が Listeners オブジェクト出力されます。

Overloads Public Shared
 Sub Main(args() As String)
   
    ' Create a trace listener for the event log.
    Dim myTraceListener As New
 EventLogTraceListener("myEventLogSource")
    
    ' Add the event log trace listener to the collection.
    Trace.Listeners.Add(myTraceListener)
    
    ' Write output to the event log.
    Trace.WriteLine("Test output")
End Sub 'Main
public static void Main(string[]
 args) {

    // Create a trace listener for the event log.
    EventLogTraceListener myTraceListener = new EventLogTraceListener("myEventLogSource");
 
    // Add the event log trace listener to the collection.
    Trace.Listeners.Add(myTraceListener);
 
    // Write output to the event log.
    Trace.WriteLine("Test output");
 }
 
int main()
{
   
   // Create a trace listener for the event log.
   EventLogTraceListener^ myTraceListener = gcnew EventLogTraceListener( "myEventLogSource"
 );
   
   // Add the event log trace listener to the collection.
   Trace::Listeners->Add( myTraceListener );
   
   // Write output to the event log.
   Trace::WriteLine( "Test output" );
}

public static void main(String[]
 args)
{
    // Create a trace listener for the event log.
    EventLogTraceListener myTraceListener = 
        new EventLogTraceListener("myEventLogSource");

    // Add the event log trace listener to the collection.
    Trace.get_Listeners().Add(myTraceListener);

    // Write output to the event log.
    Trace.WriteLine("Test output");
} //main
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.Diagnostics.TraceListener
      System.Diagnostics.EventLogTraceListener
スレッド セーフスレッド セーフ

この型は、スレッド セーフです。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EventLogTraceListener メンバ
System.Diagnostics 名前空間
TraceListener
DefaultTraceListener クラス
TextWriterTraceListener
EventLog クラス
Stream
TextWriter
Debug クラス
Trace


このページでは「.NET Framework クラス ライブラリ リファレンス」からEventLogTraceListener クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からEventLogTraceListener クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からEventLogTraceListener クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「EventLogTraceListener クラス」の関連用語

EventLogTraceListener クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EventLogTraceListener クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS