Trace in .net

C#:

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace TraceCS
{
    
class Program
    {
        
static void Main(string[] args)
        {
            Trace.Listeners.Clear();
            EventLog ev 
= new EventLog("JoeyLog""Dragon-PC""Demo");
            EventLogTraceListener eltl 
= new EventLogTraceListener(ev);
            Trace.WriteLine(
"This is a test");
        }
    }
}

VB.NET:

 

Imports System.Diagnostics

Module Module1

    
Sub Main()
        Trace.Listeners.Clear()
        
Dim ev As EventLog = New EventLog("JoeyLog""Dragon-PC""Demo")
        
Dim eltl As EventLogTraceListener = New EventLogTraceListener(ev)
        Trace.WriteLine(
"This is a test")
    
End Sub

End Module

 

posted @ 2009-06-18 11:46  N/A2011  阅读(255)  评论(0编辑  收藏  举报