惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
I
InfoQ
A
About on SuperTechFans
GbyAI
GbyAI
宝玉的分享
宝玉的分享
爱范儿
爱范儿
博客园 - 【当耐特】
博客园 - 司徒正美
博客园 - 聂微东
P
Proofpoint News Feed
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
B
Blog RSS Feed
Jina AI
Jina AI
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
博客园 - 叶小钗

博客园 - N/A2011

Managing Hierarchical Data in MySQL php soapclient with wsse 转贴 MySQL Multiple Result Procs in PHP 转贴 jQuery Datepicker by Example 转贴 Using MySQL Stored Procedures with PHP mysql/mysqli/pdo php generate pdf open office (java) ant + emma + junit Copy all files recursively from one folder to another RecursiveFileFinder 转贴: 怎样找第一份工作 PerformanceCounter in .net Trace in .net 转贴: 傅立叶级数(Fourier Series) 推导 CAS in .net Encrypting and Decrypting in .net Access Control List in .net User and Data Security in .net Unmanaged code in .net
Logger in .net
N/A2011 · 2009-06-16 · via 博客园 - N/A2011

C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;namespace LoggerCS
{
    
class Program
    {
        
static void Main(string[] args)
        {
            
if (!EventLog.Exists("Application""Dragon-PC"))
            {
                EventSourceCreationData esc 
= new EventSourceCreationData("JoeyDemo""Application");
                esc.MachineName 
= "Dragon-PC";
                EventLog.CreateEventSource(esc);
            }
            EventLog el 
= new EventLog("Application""Dragon-PC""JoeyDemo");
            el.WriteEntry(
"Event Written to Application Log", EventLogEntryType.Information, 234, Convert.ToInt16(3));
        }
    }
}

VB.NET:

Imports System.DiagnosticsModule Module1Sub Main()
        
If Not EventLog.Exists("Application""Dragon-PC"Then
            
Dim esc As EventSourceCreationData = New EventSourceCreationData("JoeyDemo""Application")
            esc.MachineName 
= "Dragon-PC"
            EventLog.CreateEventSource(esc)
        
End If
        
Dim el As EventLog = New EventLog("Application""Dragon-PC""JoeyDemo")
        el.WriteEntry(
"Event Written To Application Log", EventLogEntryType.Information, 234CType(3Short))
    
End SubEnd Module