Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8114017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:01:15+00:00 2026-06-06T03:01:15+00:00

We are using EventLog to log exceptions. there is a background thread which check

  • 0

We are using EventLog to log exceptions. there is a background thread which check once the eventlog get full and programmaticaly transfers the entries into an XML file and then clear the event log.

This works fine but it seems like there is too much work getting done, I thought it would be better to simply copy the .evt file used for logging the current application and then clear the event log.

is there any way to find the location/path of the file which will work on every windows OS?

its suggested to use

Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Services\\EventLog\\" + e.Log);

but then my application log names dont have a File property.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:01:16+00:00Added an answer on June 6, 2026 at 3:01 am

    How are you archiving them now? Maybe that method can be improved to gain performance.

    Here’s an example.

    EventLogSession els = new EventLogSession();
    els.ExportLogAndMessages("Security",             // Log Name to archive
                             PathType.LogName,       // Type of Log
                             "*",                    // Query selecting all events
                             "C:\\archivedLog.evtx", // Exported Log Path 
                             false,                  // Stop archive if query is invalid
                             CultureInfo.CurrentCulture);
    

    Or you can use the ClearLog() method.

    EventLogSession els = new EventLogSession();
    
    // Clears all the events and archives them to the .evtx file
    els.ClearLog("System",          //  Channel to Clear
                 "c:\\myLog.evtx"); //  Backup File Path
    

    More information can be found here:

    Export, Archive, and Clear Event Logs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a background-worker to do all of my processing. Inside there, I have
In my C# application I am using EventLog class to log messages. It works
Using the Redis info command, I am able to get all the stats of
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the
In a project, i'm using log4net to write down in the event log. I
I am using an unmanaged dll in cpp which I call from from my
Using code to hook the console close event from this thread , I sometimes
I've tried logging errors in my application, using the EventLog class.. But the Event
Using the following code, I'm able to display all entries listed under the Application
I'm trying to create an Event Log and Event Source at install time using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.