Results 1 to 5 of 5

Thread: exporting logs from VB.NET [solved]

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    20

    Resolved exporting logs from VB.NET [solved]

    I am writing an application that uses a custom eventLog for error / warning storage

    VB Code:
    1. If Not System.Diagnostics.EventLog.SourceExists("ILStep") Then
    2.       EventLog.CreateEventSource("ILStep", "ILStep")
    3.     End If
    4.  
    5.     evtLog = New System.Diagnostics.EventLog("ILStep")
    6.     evtLog.Source = "ILStep"

    and then to view the log, i created a new mmc panel
    VB Code:
    1. Shell("mmc ILStep.msc", AppWinStyle.NormalFocus)

    The customer asked that the logs be exported and cleared weekly. Is there a way to automate the event viewer "Export" and "Clear log" commands through the framework?
    Last edited by superuser666; Nov 23rd, 2004 at 12:34 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Not sure about the framework, but in VB6 I would use these
    APIs to do it.

    Perhaps you could use them?

    VB Code:
    1. Private Declare Function BackupEventLog Lib "advapi32.dll" Alias "BackupEventLogA" _
    2. (ByVal hEventLog As Long, ByVal lpBackupFileName As String) As Long
    3.  
    4. Private Declare Function ClearEventLog Lib "advapi32.dll" Alias "ClearEventLogA" _
    5. (ByVal hEventLog As Long, ByVal lpBackupFileName As String) As Long
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    20
    thx for the quick reply. i'll try

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No prob.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    20
    update:

    decided not to bother writing scheduling software, bought a license for eventsentry to pass to the customer...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width