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

  • SEARCH
  • Home
  • 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 3225134
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:18:15+00:00 2026-05-17T16:18:15+00:00

My (local, windows/mono) app logs important events to a text file. In case of

  • 0

My (local, windows/mono) app logs important events to a text file. In case of a sudden crash/failure/forced exit, no data should remain unwritten (as far as it’s possible). Thus I currently use a simple append-to-text-file approach:

Public Shared Sub LogAppEvent(ByVal EventData As String)
    Dim Config As ConfigHandler = ConfigHandler.GetSingleton()
    Dim AppLog As New IO.StreamWriter(Config.GetUserFilesRootDir() & ConfigOptions.AppLogName, True)
    AppLog.WriteLine(String.Format("[{0}] {1}", Date.Now.ToString(), EventData))
    AppLog.Close()
End Sub

This is highly sub-optimal, but log events are pretty rare. Would you recommand moving to the System.Diagnostics logging class?

Or maybe would you suggest another solution?

  • 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-05-17T16:18:15+00:00Added an answer on May 17, 2026 at 4:18 pm

    If a super basic approach like this is functionally sufficient for your needs, you can stick with it. But, you might ask yourself a few questions to make sure:

    • Is it possible for events to be logged concurrently by multiple threads? This function is not threadsafe

    • Is error notification needed?

    • Is there a risk of the log files growing without bounds with no automated pruning?

    • Would you benefit from more extensive logging so that you had more info about events leading up to an error?

    • Would you benefit from more detail about errors (stack trace, exception details, etc)

    • Does your program run on multiple computers? If so, how do logs get to you?

    • Is there any need/value in tools to help analyze log files (either singularly or finding patterns such as common errors across many log files)?

    If you decide that you have other requirements, there are a number of free logging frameworks such as NLog or log4net that can help record more detailed logs, and there are several commercial products such as GIBRALTAR and SmartInspect available that can help with log management and analysis.

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

Sidebar

Related Questions

I have a local windows app written in java, kind of crm. Employees register
How to transfer a file over FTP from my local Windows machine to a
I installed solr-3.6 in my local windows box and it worked fine. I installed
This code runs on my local RoR/Windows 7 (64-bit): sql = ActiveRecord::Base.connection() last_pk =
How to instal in SVN repository server on Windows local Machine.?
How do I find the local path on Windows in a command prompt?
My Windows account has administrator rights on a local SQL Instance. I am able
I built a windows service on my local machine. when I install and run
I have a Windows service that runs as a logged-in user (local admin). During
By default in windows application setting are saved in this directory: %USERPROFILE%\Local Settings\Application Data\<Company

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.