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 8970873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:48:53+00:00 2026-06-15T17:48:53+00:00

My current C# application is a single executable (EXE) and a few DLLs (so

  • 0

My current C# application is a single executable (EXE) and a few DLLs (so multiple binaries) and I want to create a LOGGER (some simple custom logger that writes to a single text file no matter where it is being called from – and this should be available in all the binaries (exe and dll’s) – note that it is a single threaded application.

Right now I have a DLL (Logger) and it has a class (Log) with a method (trace) which logs, each project adds a reference to this DLL (Logger) and creates its own instance (pass in a file name) and then calls the .Trace(…) function – works fine …

But I would rather not have to create many different trace files (minimum one per project) and having to create a new instance of Logger each time seems repetitive … So I was looking into either creating a STATIC logger class or using a SINGLTON … I am just not sure which is best and why …

I was hoping someone could maybe point me in the right direction on this, what is the best way to create a logger class (it will be its own DLL) that will be used by many projects (referenced) and they should all write to the same log file…?

Any help would be much appreciated.
Thanks,

  • 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-15T17:48:54+00:00Added an answer on June 15, 2026 at 5:48 pm

    You choose between Singleton and Static logger the same way you always choose between the two: Do you want to be able to override methods (or use a Logging interface)? If you use a singleton, you have the opportunity to override methods to change functionality. You can even abstract the behavior away behind an interface.

    With a static class you are now and forever tied to that class, and any changes affect everyone.

    When dealing with my own systems, i have moved towards singleton instanced objects. It gives a level of flexibility not available with static classes.

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

Sidebar

Related Questions

I am current writing an application that will require multiple inserts, updates and deletes
I have a single page application which create and remove a number of iframe
I'm deserializing some XML from an old application into an object in my current
I have an application that consist of multiple components, each compiled into single DLL,
My single page application loads a home page and I want to display a
My current application is using single instance of an object as a global variable
I create a brand new Single View Application iPhone app in Xcode 4.2, it
I have a very simple application which currently has a single Linq to Sql
In Single Document Interface (SDI) or Multiple Document Interface (MDI) MFC application, I created
I want to write some testscripts that create some files and execute commands that

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.