eventlog的使用
各位 我想请问一下在编写windows服务中 eventlog应该如何使用 我写了个小程序 可是log总是写不进去呢
大家能帮我看看嘛?
Protected Overrides Sub OnStart(ByVal args() As String) t.Start() End Sub Protected Overrides Sub OnStop() b = False t.Abort() End Sub Sub deleteFile() While Not b Dim objFolder As Scripting.Folder Dim objFile As Scripting.File Dim strPath As String strPath = "d:\test\" objFolder = FSO.GetFolder(strPath) For Each objFile In objFolder.Files Dim strpath1 = objFile.Path Dim fi As New System.IO.FileInfo(strpath1) Dim fs As System.Security.AccessControl.FileSecurity = fi.GetAccessControl() Dim ir As System.Security.Principal.IdentityReference = fs.GetOwner(GetType(Security.Principal.SecurityIdentifier)) Dim ir1 As System.Security.Principal.IdentityReference = ir.Translate(GetType(Security.Principal.NTAccount)) Dim name As String = ir1.Value Dim objname As String = objFile.Name If name Like "*A*" Then objFile.Delete() EventLog1.WriteEntry(objname + "deleted succesfully") End If Next objFile Thread.Sleep(60000 * 60 * 24) End While End SubEnd Class